Atari ST fan
Posts: 8
52 credits Members referred : 0
« on: May 08, 2006, 05:00:40 pm »
Hi Olaf, I just downloaded your 'upload' class. Thanks, it's great! I just have one little request: could the program work if all the files are in same folder? Like they are when you download and extract them. I know its not a huge problem to amend where the include file locations are but... it would've saved me a bit of time and i would 've seen things work straight away. I wrote this and added it to 'multiple_upload_example.php': <?php //==START OF AMENDMENT============================================================== $upload_class_file_name = "upload_class.php"; $upload_class_path = $_SERVER['DOCUMENT_ROOT']."/classes/upload/";
if (file_exists($upload_class_path . $upload_class_file_name)) { include ($upload_class_path . $upload_class_file_name); //classes is the map where the class file is stored (one above the root) }elseif(file_exists($upload_class_file_name)){ include ($upload_class_file_name); //if a first time user has dropped all upload files into the same directory, things still work. }else{ echo "<h2>Missing Include File</h2><p>Please check the include file locations for the upload programme to work properly.</p>"; echo "<p>[Hint: Check this PHP script near the line that has the words \"include ...$upload_class_file_name\" in it!]</p>"; exit; } //==END OF AMENDMENT================================================================ //error_reporting(E_ALL); $max_size = 1024*100; // the max. size for uploading
class muli_files extends file_upload {
var $number_of_files = 0; var $names_array; ................php code continues........
Would you consider adding it?
Thanks again for the upload class, really appreciate what you do.. Mark
« Last Edit: May 08, 2006, 05:10:19 pm by olaf »
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #1 on: May 08, 2006, 05:52:22 pm »
Hello of course its possible toch check first if a file exists and if not then show the upload form.
You need a tmp folder for the upload, and you need the rights to replace the file. And I think that this is the problem...
Atari ST fan
Posts: 8
52 credits Members referred : 0
« Reply #2 on: May 08, 2006, 09:23:37 pm »
Hi Olaf, I'm not talking about the uploaded files that are uploaded by your PHP script. I'm talking about the files YOU have created and their relationship with each other! The files you publish (foto_upload.phpو multiple_upload_example.php upload_class.phpupload_example.php) all require that they exist in certain directories to each other to work properly. If any of your files are not in the correct directory that the other files expect, when PHP runs it gives an error. I'm trying to help when someone downloads your scripts for the first time. I'm trying to help so that your script 'just works'. If, (as I did) someone just extracts the files to a single directory, they won't work. My addidition makes them work in THAT situation.The scripts would check for the 'include' files in their own directory as well as where you initially put them. Mark
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #3 on: May 08, 2006, 09:26:07 pm »
Maybe adding a set_include_path() would help? (I don't know the script but that works with anything)
Hi Olaf, I'm not talking about the uploaded files that are uploaded by your PHP script. I'm talking about the files YOU have created and their relationship with each other! The files you publish (foto_upload.phpو multiple_upload_example.php upload_class.phpupload_example.php) all require that they exist in certain directories to each other to work properly. If any of your files are not in the correct directory that the other files expect, when PHP runs it gives an error. I'm trying to help when someone downloads your scripts for the first time. I'm trying to help so that your script 'just works'. If, (as I did) someone just extracts the files to a single directory, they won't work. My addidition makes them work in THAT situation.The scripts would check for the 'include' files in their own directory as well as where you initially put them. Mark
Mark, the example files will work in this structure:
your_root/classes/upload/
of course you have to change the pathes in all files. The class is the product and the example have to show you how it "could" work. And it works the download count is > 20000 (plus several thousands at php classes dot org)
Atari ST fan
Posts: 8
52 credits Members referred : 0
« Reply #5 on: May 09, 2006, 05:39:23 am »
Olaf, i think what you;ve done is great. When i first started programming, i'd download some code, stick it in directory and see if it would work. If things went wrong first time, i'd have a quick look to see if i could get it to work but because i was inexperienced there was a big chance that if it didn't work first time i'd delete the files. Ok, maybe not the best thing to do if you want to learn about code but most often there would be some kind of time constraint involved. If a script worked 'out of the box', there was a huge increase in the chances of me using and abusing it. 20K downloads is fantastic. I'm only going on my experiences at downloading code but i expect the percentage of the people actually using the downloaded code would increase if your script worked straight after being unpacked. Mark
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #6 on: May 09, 2006, 09:09:58 am »
Hello,
If you use the suggested directory structure and you put all the files there than it have to work. I do the same, I have the same structure on my my notebook while testing.
But don't forget this script is a php class and not a upload system out of the box. The good point is you can use this class in you own application without to use some code you never wanted. I think your problem is that object oriented programming is new to you, correct me if I'm wrong.
but maybe its better to put this code at the begin of you script to know what its wrong:
Code:
error_reporting(E_ALL);
Atari ST fan
Posts: 8
52 credits Members referred : 0
« Reply #7 on: May 09, 2006, 09:20:25 am »
olaf, I've been programming for 8 years. Some oop, some not. I'm trying to help people that download your script get started. Forget it. mark
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
olaf, I've been programming for 8 years. Some oop, some not. I'm trying to help people that download your script get started. Forget it. mark
OK, now I understand what you try to do...but again the scripts works like provided... and uploading files is not a php beginners job! (thats my opinion)
but are 8 years a web developer or (just) a programmer?
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=2450