COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > Stashbox & Shup Archive

 
 
Thread Tools Display Modes
Old 06-08-2009, 08:17 AM   #1
Jae.Thomas
Human being with feelings
 
Join Date: Jun 2006
Posts: 22,572
Default 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.
Jae.Thomas is offline  
Old 06-08-2009, 09:08 AM   #2
Dan
up here in my tree
 
Dan's Avatar
 
Join Date: Jan 2005
Location: warehouse
Posts: 667
Default

$my_local_path needs to be absolute, rather than relative to your webroot.
Dan is offline  
Old 06-08-2009, 09:12 AM   #3
Jae.Thomas
Human being with feelings
 
Join Date: Jun 2006
Posts: 22,572
Default

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
Jae.Thomas is offline  
Old 06-08-2009, 09:13 AM   #4
Jae.Thomas
Human being with feelings
 
Join Date: Jun 2006
Posts: 22,572
Default

now what permissions should be set? Without giving too many
Jae.Thomas is offline  
Old 06-08-2009, 03:51 PM   #5
Dan
up here in my tree
 
Dan's Avatar
 
Join Date: Jan 2005
Location: warehouse
Posts: 667
Default

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?
Dan is offline  
Old 06-11-2009, 05:04 AM   #6
bambiboi
Human being with feelings
 
Join Date: Jun 2009
Posts: 1
Default 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.
bambiboi is offline  
Old 06-11-2009, 01:12 PM   #7
Dan
up here in my tree
 
Dan's Avatar
 
Join Date: Jan 2005
Location: warehouse
Posts: 667
Default

Quote:
Originally Posted by bambiboi View Post
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!
Dan is offline  
Old 07-28-2009, 04:52 AM   #8
rfu
Human being with feelings
 
Join Date: Jul 2009
Posts: 5
Default

@Jason Brian Merrill: thanks, now it works for me too
rfu 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 06:15 AM.


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