5, December 2008

[Solved] Custom path? - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: [Solved] Custom path?
« previous next »
Pages: [1] Print

Author Topic: [Solved] Custom path?  (Read 877 times)
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« on: Jan 11, 2007, 07:11:04 PM »

Nevermind, finally made it to work.

Hi,

I'm trying to make a more generic upload page, based on the example file but...

I want the path to change depending on the querystring of the page.

I tried setting the paths on an array and then setting the upload_dir from it but it didn't work.

$pathh[1] = "../images/products1/";
$pathh[2] = "../images/products2/";

$my_upload = new file_upload;

$my_upload->upload_dir = $pathh[$colname_cc];

I tried using if statements, didn't work either.

Every time time I get the error that the directory does not exist.
When I set the make dir option to true, it seems that its trying to make a dir.. nowhere! Here's the debug:

Warning: mkdir() [function.mkdir]: No such file or directory in /Library/WebServer/Documents/mysite/upload_class/upload_class.php on line 150

Warning: move_uploaded_file(1168535720.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /Library/WebServer/Documents/mysite/upload_class/upload_class.php on line 130

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/phpNiFkAV' to '1168535720.jpg' in /Library/WebServer/Documents/mysite/upload_class/upload_class.php on line 130

Any suggestions? Thanks
« Last Edit: Jan 11, 2007, 07:31:00 PM by konkapp »
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #1 on: Jan 11, 2007, 08:19:11 PM »

Good to hear you got it working! What about sharing the solution to your problem, so other people with the same problem can find the solution here?

Oh and welcome to the forums!


Last blog : Are You Stumbling Yet?
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« Reply #2 on: Jan 11, 2007, 08:39:58 PM »

Now that i'm 100% sure that it really works after testing Evil here it is:

You dont set the path prior to submitting the form so the code should look like this:

Delete the my_upload->upload_dir reference and place it inside the if clause

if(isset($_POST['Submit'])) {

   $my_upload->the_temp_file = $_FILES['upload']['tmp_name'];
   $my_upload->the_file = $_FILES['upload']['name'];
   $my_upload->http_error = $_FILES['upload']['error'];
   $my_upload->replace = (isset($_POST['replace'])) ? $_POST['replace'] : "n";    $my_upload->do_filename_check = (isset($_POST['check'])) ? $_POST['check'] : "n";    $new_name = (isset($_POST['name'])) ? $_POST['name'] : "";

// Place whichever html form element and simply post its value.
// For my case, it is a list box, populated from a recordset.
// The list box value is the path e.g. "../images/products1/"

   $my_upload->upload_dir = $_POST['updir'];


   $my_upload->upload($new_name);
}

That simple!
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6486
39748 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Jan 11, 2007, 08:41:04 PM »

?

great that your snippet is working now!


Last blog : Just a better Internet portal provided by Google
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=5578
Tags : Upload path multiple upload path easy php upload Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: [Solved] Custom path?
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Dec 05, 2008, 06:01:21 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.995
Total Topics: 7.685
Total Members: 4.468
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: sansthaa

25 Guests, 4 Users online :

10 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.