HoTDaWg Posted March 13, 2006 Share Posted March 13, 2006 hello,I have this script which allows users to upload files. I get the following error:[code]Parse error: syntax error, unexpected ',' in /home/cortez/public_html/testscripts/photoalbums/upload.php on line 2[/code]All i want to do is to be able to have more than just .gif images available for upload. I want jpg, and bmp, etc. here is the code for upload.html[code]<html><head><title>Upload now!</title></head><form action="upload.php" method="post" enctype="multipart/form-data"> <p>File Upload</p> <label for="file">File</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /></form><body bgcolor="#FFFFFF"></body></html>[/code]and the code for upload.php[code]<?phpif (($_FILES["file"]["type"] == "image/gif", "images/jpg") &&($_FILES["file"]["size"] < 150000)) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; echo "Uploading " . $_FILES["file"]["name"]; echo " (" . $_FILES["file"]["type"] . ", "; echo ceil($_FILES["file"]["size"] / 1024) . " Kb).<br />"; if (file_exists("uploads/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; echo "Please delete the destination file and try again."; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]); echo "File has been stored in your uploads directory."; }} else echo "Sorry, we only accept .GIF images under 15Kb for upload.";?> [/code]help would be greatly appreciated. Thanks.HoTDaWg Quote Link to comment https://forums.phpfreaks.com/topic/4796-uploading-images-problem/ Share on other sites More sharing options...
lpxxfaintxx Posted March 13, 2006 Share Posted March 13, 2006 Try[code]<?phpif (($_FILES["file"]["type"] == "image/gif" OR "images/jpg") &&($_FILES["file"]["size"] < 150000)) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; echo "Uploading " . $_FILES["file"]["name"]; echo " (" . $_FILES["file"]["type"] . ", "; echo ceil($_FILES["file"]["size"] / 1024) . " Kb).<br />"; if (file_exists("uploads/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; echo "Please delete the destination file and try again."; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]); echo "File has been stored in your uploads directory."; }} else echo "Sorry, we only accept .GIF images under 15Kb for upload.";?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/4796-uploading-images-problem/#findComment-16865 Share on other sites More sharing options...
HoTDaWg Posted March 13, 2006 Author Share Posted March 13, 2006 thanks a lot dude. Btw, LP and FM RULES! W00T! Quote Link to comment https://forums.phpfreaks.com/topic/4796-uploading-images-problem/#findComment-16866 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.