|
06-08-2009, 08:17 AM
|
#1
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,572
|
help me with my custom uploader script...
Code:
<?php
$file_input_name = "file";
$my_local_path = '/shupFiles';
$my_web_root = "http://www.jasonbrianmerrill.com/shupFiles";
$filename = "";
$error = "";
from here on in, it is the same exact to the custom uploader script from the shupdir.
this is my public html dir:
www.jasonbrianmerrill.com/uploadform.html
here are my permissions:
are those right? lol
Last edited by Jae.Thomas; 06-08-2009 at 08:19 AM.
|
|
|
06-08-2009, 09:08 AM
|
#2
|
up here in my tree
Join Date: Jan 2005
Location: warehouse
Posts: 667
|
$my_local_path needs to be absolute, rather than relative to your webroot.
|
|
|
06-08-2009, 09:12 AM
|
#3
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,572
|
Code:
<?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__).'/shupFiles/';
$my_web_root = "http://www.jasonbrianmerrill.com/shupFiles/";
$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();
?>
got it working!!!!
http://www.jasonbrianmerrill.com/shupFiles/RealMen.jpg
|
|
|
06-08-2009, 09:13 AM
|
#4
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,572
|
now what permissions should be set? Without giving too many
|
|
|
06-08-2009, 03:51 PM
|
#5
|
up here in my tree
Join Date: Jan 2005
Location: warehouse
Posts: 667
|
g+rw so apache can read/write the files dir, just make sure your user is in the www group.
If that works, start cutting back perms until it stops working?
|
|
|
06-11-2009, 05:04 AM
|
#6
|
Human being with feelings
Join Date: Jun 2009
Posts: 1
|
Custom uploader
Sorry to hi-jack this a bit, but didn't wanna make a new thread for a little Q.
How do I set the username/password for my own site's uploader. I've got .htaccess username password combo for the upload dir which holds my upload.php?
On a side note, would be awesome if you guys would add FTP instead of .php just coz of the easiness of it.
I just found this program and uninstalled ZScreen coz of this. This is so much lighter and more efficient, no lag at all.
Ty.
|
|
|
06-11-2009, 01:12 PM
|
#7
|
up here in my tree
Join Date: Jan 2005
Location: warehouse
Posts: 667
|
Quote:
Originally Posted by bambiboi
Sorry to hi-jack this a bit, but didn't wanna make a new thread for a little Q.
How do I set the username/password for my own site's uploader. I've got .htaccess username password combo for the upload dir which holds my upload.php?
On a side note, would be awesome if you guys would add FTP instead of .php just coz of the easiness of it.
I just found this program and uninstalled ZScreen coz of this. This is so much lighter and more efficient, no lag at all.
Ty.
|
Shup doesn't support http authentication atm, so your best bet is to do authentication from within your PHP script and add the login parameters to the custom uploader as necessary. HTTP auth seems like something we should have though, so it might sneak in at some point.
Glad you like Shup!
|
|
|
07-28-2009, 04:52 AM
|
#8
|
Human being with feelings
Join Date: Jul 2009
Posts: 5
|
@Jason Brian Merrill: thanks, now it works for me too
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 06:15 AM.
|