class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
you have a nice script. i just downloaded it and wanted to konw
1. how can I upload a file so it will over write previously uplloaded file with the same name.( I do not want the script to create another file XXXXX_1.jpg) 2. can the script uplade d any type of file ( .xls , .csv, .pdf , ...)
1. As per the FAQ: You should use $handle->file_auto_rename = false; to prevent the class renaming the file automatically, and then $handle->file_overwrite = true; to allow the class to overwrite the file. This also works when working on local files.
2. Yes, it can. You may want to add some more MIME types in $handle->allowed if some are missing for your specific files.Reply
I'm finding that if i'm in the same browser session I can overwrite once. If I try and overwrite a second time then the second image will not get overwritten. I can see options to make directories overwritable but I cannot see anything to try and chmod files you are about to overwrite. I've got $handle->file_auto_rename = false; $handle->file_overwrite = true; already. and iv'e got this on 2 different places and tested it quite a few times to be sure.Reply
Does it have the same behaviour on a second server? It may be a problem of uname.
I tried here to upload one file, and to process it three time, overwriting the first file twice. The only file remaining is the last one, so the overwriting worked both times. See the excerpt of my log:
source is an uploaded file
[...]
- no auto_rename if same filename exists
- destination file details
file_dst_name : abcdef1.jpg
file_dst_pathname : ./test/abcdef1.jpg
- no overwrite checking
[...]
- no auto_rename if same filename exists
- destination file details
file_dst_name : abcdef1.jpg
file_dst_pathname : ./test/abcdef1.jpg
- no overwrite checking
[...]
- no auto_rename if same filename exists
- destination file details
file_dst_name : abcdef1.jpg
file_dst_pathname : ./test/abcdef1.jpg
- no overwrite checking
Is it what you do: upload one image, and overwrite it several times, calling process() several times? Can you paste here your resulting log? Do you have any errors (PHP errors when attempting to overwrite)?Reply
Theres nothing wrong. I will just set permissions to 755 on all the images before I deploy the applications. When I applied this fact then all your commands worked 100%. Some of the files were owned by apache after early usage of the application in the "test" directory. I will just deploy all images to 2 places and set full permission on all the media.
I will get back to you if I have any other thoughts. I think a normal php chmod 0777 will work on all the files that are written to the "test" folder. I'm still using the upload.php to a large degree...Reply
you have a nice script. i just downloaded it and wanted to konw
1. how can I upload a file so it will over write previously uplloaded file with the same name.( I do not want the script to create another file XXXXX_1.jpg)
2. can the script uplade d any type of file ( .xls , .csv, .pdf , ...)
thanks so much
jeff
2. Yes, it can. You may want to add some more MIME types in $handle->allowed if some are missing for your specific files.
I can see options to make directories overwritable but I cannot see anything to try and chmod files you are about to overwrite. I've got
$handle->file_auto_rename = false;
$handle->file_overwrite = true; already. and iv'e got this on 2 different places and tested it quite a few times to be sure.
I tried here to upload one file, and to process it three time, overwriting the first file twice. The only file remaining is the last one, so the overwriting worked both times. See the excerpt of my log:
Is it what you do: upload one image, and overwrite it several times, calling process() several times? Can you paste here your resulting log? Do you have any errors (PHP errors when attempting to overwrite)?
I will get back to you if I have any other thoughts. I think a normal php chmod 0777 will work on all the files that are written to the "test" folder. I'm still using the upload.php to a large degree...