COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 07-15-2011, 12:59 PM   #1
pipelineaudio
Mortal
 
pipelineaudio's Avatar
 
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 14,047
Default upload filed check uploader settings

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();

?>
pipelineaudio is offline  
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  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:03 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.