File upload and Netscape

From: Date: Wed, 01 Nov 2000 21:35:20 +0000
Subject: File upload and Netscape
Groups: php.general 
Request: Send a blank email to php-general+get-23246@lists.php.net to get a copy of this message
I am having trouble with a script that was designed upload a file to our server. The script works fine under explorer netscape but returns an error message that makes no sence to me when run under Netscape. The error message and code follow. Error Message is: Not Found The requested URL /modules/ was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Code: <? // fileupload.dpm - takes an uploaded file and moves it to specified path //called like // http://www.dallypost.com/modules/fileupload.php?path=/www/dhtdocs/test/&filename=sample.gif //or // http://www.dallypost.com/modules/fileupload.php?path=/www/dhtdocs/test/ function fileupload ($saveas) { global $userfile, $userfile_name, $userfile_size, $userfile_type; global $path; global $filename; global $ext; global $buildfilename; //define global color and table attributes global $t1bgcolor; global $t1border; global $t1cellpadding; global $t2bgcolor; global $t2border; global $t2cellpadding; global $titlefontsize; global $titlefontcolor; global $basefontsize; global $basefontcolor; global $linkcolor; global $basecolor; global $accentcolor; $basecolor = $t2bgcolor; //accentcolor($basecolor); print("<FONT face=arial size=$titlefontsize color=$titlefontcolor><B>File Upload Tool</B></FONT><P>"); if(!isset($userfile)) { print("<pre>"); print("<form enctype=\"multipart/form-data\" action=\"$PHP_SELF\" method=\"POST\">"); print("Image or Sound File: <input name=\"userfile\" type=\"file\" SIZE=30 MAXLENGTH=30>\n"); if(isset($filename)) { print(" Save file as: $filename\n\n"); print("<input type=\"hidden\" name=\"filename\" value=\"$filename\">"); print("<input type=\"hidden\" name=\"buildfilename\" value=\"N\">"); }//endif(isset(name)) else { print(" Save file as: <INPUT TYPE=\"TEXT\" NAME=\"filename\" VALUE=\"\" SIZE=30 MAXLENGTH=30>"); print("<B>.</B><SELECT NAME=\"ext\">"); print("<OPTION>gif"); print("<OPTION>jpg"); print("<OPTION>htm"); print("<OPTION>wsa"); print("</SELECT>\n\n"); print("<input type=\"hidden\" name=\"buildfilename\" value=\"Y\">"); }//end else print("<input type=\"hidden\" name=\"path\" value=\"$path\">"); print("<input type=\"submit\" value=\"Upload\">"); print("</form>"); print("</pre>"); print("<P>"); if(!isset($filename)) { print("File naming requirements: <UL> <LI>All files should be named using numbers and letters only without spaces or special characters. <LI>File extensions gif and jpg) are the only valid file types for image files. You must set the extension to match the file type as it was saved on your harddrive. <LI>The file extension htm is for additional html files. You can upload files in this format and thereby extend your web site beyond the scope of the pages provided by DallyPost templates. <LI>The file extension wsa is a custom encoded sound file. These files can be uploaded to add sound to your web pages. Contact your technical support representative for assistance in converting your sound files to a format that will work on the your DallyPost web site. </UL>"); }//endif(!isset(name)) }//endif else { //combine parts to build a valid file name if($buildfilename == "Y") { $filename .= "."; $filename .= $ext; }//end if($buildfilename == "Y") $t_filename = $path; $t_filename .= $filename; if(!is_dir("$path")) { if(mkdir("$path", 0777)) { print("<P><FONT face=arial size=$titlefontsize color=$titlefontcolor>Upload Directory has been created</FONT>"); } }//endif(!is_dir("$path")) if (!copy($userfile, $t_filename)) { die ("Error copying uploaded file to destination!"); }//endif unlink ($userfile); print("<P><FONT face=arial size=$titlefontsize color=$titlefontcolor>$filename has been successfully uploaded</FONT>"); print("<P><A HREF=http://www.dallypost.com/memberservices/webbuilder.php> <FONT face=arial size=$titlefontsize color=$titlefontcolor>Click here to continue</FONT></A>"); }//end else }//end function fileupload($saveas); ?>

« previous php.general (#23246) next »