Jump to content

image error


anand.arjunan

Recommended Posts

Hi all i have upload the image and rename the image but the image not visible in ie or any other browserPlease help me it is urgentsee my coding<?php$path=$_SERVER['DOCUMENT_ROOT'];$pro='/upload/';$uploadDir = $path.$pro;if(isset($_POST['upload'])){$fileName = $_FILES['userfile']['name'];$tmpName = $_FILES['userfile']['tmp_name'];$fileSize = $_FILES['userfile']['size'];$fileType = $_FILES['userfile']['type'];$filePath = $uploadDir . $fileName;// get the file extension first$ext = substr(strrchr($fileName, "."), 1); // make the random file name$randName = md5(rand() * time());$imag=$randName.'.' . $ext;// and now we have the unique file name for the upload file$filePath = $uploadDir . $randName . '.' . $ext;$result = move_uploaded_file($tmpName, $filePath);}?><form method="post" enctype="multipart/form-data"><table width="71%" border="0" cellpadding="1" cellspacing="1" class="box" align="center" ><tr> <td width="47%"><input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input name="userfile" type="file" id="userfile"> </td><td width="53%"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td></tr></table></form>

Link to comment
Share on other sites

Question looks really familiar.Again, I think we need some more information before can help you out. Have you checked the upload folder in whatever document root is? If the file is there (and if php ran the script without any errors, I assume it is) and it doesn't show up on the browser then perhaps it's a permissions problem.

Link to comment
Share on other sites

Question looks really familiar.Again, I think we need some more information before can help you out. Have you checked the upload folder in whatever document root is? If the file is there (and if php ran the script without any errors, I assume it is) and it doesn't show up on the browser then perhaps it's a permissions problem.
Ya it is working fine the image was uploaded the image name was change like this 3e4e9af94bc4e358c56f58f18e6c1cb9.jpg but the image was not visible in browser please check and run this code
Link to comment
Share on other sites

And is the path to the image okay where you attempt to display it?Add an alt= tag to the html image tag to see if that might be the problem. Maybe the path you are using in the image tag is not correct?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...