View Single Post
Old 07-17-2011, 08:47 AM   #2
Dan
up here in my tree
 
Dan's Avatar
 
Join Date: Jan 2005
Location: warehouse
Posts: 667
Default

Quote:
Originally Posted by pipelineaudio View Post
Ok I think I got the php file set up on my server, but I'm still getting this error, what do I check next?

here's my php file

<?php

/************************************************** *******
the custom uploader does a simple http post request to your url.
it expects the following return on error:

<upload><error>some error message here</error></upload>

it expects the following return on success:

<upload><url>http://someurlhere.com/blah.png</url></upload>

the xml return is whitespace-insensitive, so feel free to throw in
some newlines or whatever between tags if that be your thing.

remember, your script can do whatever it wants on the backend, but it MUST
use our return format. such is life.

daniel green / regis nebor
http://shup.com | http://stashbox.org
************************************************** ********/

$file_input_name = "file";
$my_local_path = dirname(__FILE__).'/filez/';
$my_web_root = "http://pipelineaudio.net/shup/files/";
$filename = "";
$error = "";

function do_xml()
{
global $my_web_root;
global $filename;
global $error;
header('Content-type: text/xml');
if ($error)
die("<upload><error>$error</error></upload>");

die("\r\n\r\n<upload><url>" . $my_web_root . $filename . "</url><filename>" . $filename . "</filename></upload>\r\n\r\n");
}

$error = "";

if (!$_FILES)
{
$error = "No data was submitted. Try checking your browser settings and retry your request.";
do_xml();
}

$file = $_FILES[$file_input_name];

if (!$file)
{
$error = "The file was not uploaded properly.";
do_xml();
}

$filename = basename($file["name"]);

if (!move_uploaded_file($file["tmp_name"], $my_local_path . $filename))
$error = "Error saving file to disk.";

do_xml();

?>
right off the bat I can see that your $my_local_path and $my_web_root variables don't match up. one says "filez" and the other "files".
Dan is offline