PDA

View Full Version : uploading images


N!ck
03-03-2003, 01:42 AM
Following is part of a script I'm working on to upload pictures. I'm getting an error that no file was uploaded, but this is just not the case. I double-checked that I have the attribute on my form tag (enctype="multipart/form-data"), and I also made sure that the name of the file field was correct.

Does anyone see anything that might be causing the problem?


...
if ($action=="upload") {
if ($bbuserinfo[userid]=="0" or $bbuserinfo[userid]=="") {
show_nopermission();
exit;
}
if (empty($picfile)) {
eval("standarderror(\"".gettemplate("error_gallery_nopic")."\");");
exit;
}
$filename=str_replace(" ","_",$picfile_name);
$targetname=$gallerypath."/photos/".$bbuserinfo[userid]."/".$filename;
$targetthumb=$gallerypath."/thumbs/".$bbuserinfo[userid]."/".$filename;
if (file_exists($targetname) or file_exists($targetthumb)) {
eval("standarderror(\"".gettemplate("error_gallery_filename")."\");");
exit;
}
...

N!ck
03-03-2003, 01:50 AM
Also note, there is no value set for the uploads tmp dir in my phpinfo...any way to use my own tmp folder?

filburt1
03-04-2003, 01:37 PM
A really long PHP uploads tutorial: http://www.webdesignforums.net/thread1873.html

Remember you have to copy the temp file before the page is done executing, otherwise it will be nuked. And yes, I do believe you need to set an upload destination in your php.ini.

N!ck
03-04-2003, 09:25 PM
Thanks filburt. I've done some work on it and got it *almost* working. That particular problem is fixed. :)