Warning: move_uploaded_file(gallery/photos/Yeah Thats Me....jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/chill/public_html/upload.php on line 192
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpPre4yT' to 'gallery/photos/Yeah Thats Me....jpg' in /home/chill/public_html/upload.php on line 192
Duplicate entry '/gallery/photos/.jpg' for key 2insert error
AM GETTING THIS ERROR AFTER I TRY TO UPLOAD A PHOTO USING MY UPLOADER I NEVER USE TO SEE THIS ERROR BUT ALL OF A SUDDEN SINSE I SWITCH HOST I SEE THAT CAN U TELL ME WATS WRONG?
/////////////////////////////////Members List
error_reporting(E_ALL);
// we first include the upload class, as we will need it here to deal with the uploaded file
$userinfo = mysql_fetch_array(mysql_query("SELECT name, sex FROM ibwf_users WHERE id='".$uid."'"));
$membername = $userinfo[0];
// we have three forms on the test page, so we redirect accordingly
if ($_POST['action'] == 'image') {
echo "<p align=\"center\">";
// ---------- IMAGE UPLOAD ----------
// we create an instance of the class, giving as argument the PHP object
// corresponding to the file field from the form
// All the uploads are accessible from the PHP object $_FILES
$handle = new Upload($_FILES['my_field']);
// then we check if the file has been uploaded properly
// in its *temporary* location in the server (often, it is /tmp)
if ($handle->uploaded) {
// yes, the file is on the server
// below are some example settings which can be used if the uploaded file is an image.
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 150;
// now, we start the upload 'process'. That is, to copy the uploaded file
// from its temporary location to the wanted location
// It could be something like $handle->Process('/home/www/');
$handle->Process('usergallery/');
// we check if everything went OK
if ($handle->processed) {
// everything was fine !
echo ' file uploaded with success<br/>';
echo ' <img src="usergallery/' . $handle->file_dst_name . '" /><br/>';
$info = getimagesize($handle->file_dst_pathname);
echo ' link to the file just uploaded: <a href="usergallery/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a><br/>';
$imageurl = "usergallery/$handle->file_dst_name";
$reg = mysql_query("INSERT INTO ibwf_usergallery SET uid='".$uid."', imageurl='".$imageurl."', sex='".$userinfo[1]."', time='".(time() - $timeadjust)."'");
} else {
// one error occured
echo ' file not uploaded to the wanted location<br/>';
echo ' Error: ' . $handle->error . '<br/>';
}
// we delete the temporary files
$handle-> Clean();
} else {
// if we're here, the upload file failed for some reasons
// i.e. the server didn't receive the file
echo ' file not uploaded on the server<br/>';
echo ' Error: ' . $handle->error . '';
}
echo "</p>";