Jump to content

Some photos won't move to directory..


jwk811

Recommended Posts

$pic = $_FILES['photo'];

	$ext = substr(strrchr($pic['name'], "."), 1); 
	$imagePath = md5(rand() * time()) . ".$ext";

$target = "images/";
$target = $target . $imagePath;


move_uploaded_file($pic['tmp_name'], $target);

 

 

It works for me and I don't think it's the extension because it's always .jpg and it works for me. I just don't get what could be happening. It worked before perfectly until I changed things around but it's still the SAME! And the directory has just the same permissions as the last one when it worked.

Link to comment
Share on other sites

http://www.phpfreaks.com/forums/index.php/topic,292945.msg1386624.html#msg1386624

 

The code at that link will check for and display upload errors. At the point where it has a the comment // put any type, size, file name/extension, or content validation here, you can put in any of the application level validation you need before you use move_uploaded_file() or put some of the uploaded file information into a database query statement.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.