Jump to content

Uploading photos problem !!


webtuto

Recommended Posts

hi ,

i made a website where the admin can add photos to his page like an image gallery

so there are two pages where the admin is able to ad d these photos

the first one , everything is OK , the photo get uploaded succusfuly

 

but on the other page the upload fail !!!!!!!

 

even if its the same code

i gave chmod777 to the photos file

any help is appreciated thanks

 

Link to comment
Share on other sites

the problem is not frrom the code

the problem is from something else

because i have two pages

 

the first one this code work succusfuly

and the other one no ?

and in my computer the two of theme WORKED

but when i host it on my host , it didnt wanna upload the photo

you see the problem ??

Link to comment
Share on other sites

Omg...

 

No.

 

How would I know what the problem is? Read over this thread, and pretend you're me, who doesn't know anything about your problem. Do you understand?

 

You haven't given any details, code, or examples.

Link to comment
Share on other sites

thats the code

 

	$width = 110;
	$height = 83;
	$thumb = "thumbs/";
 	$tmp = $_FILES['photo']['tmp_name'];
	$name = $_FILES['photo']['name'];
	$destination = "photos/";

	$upload = move_uploaded_file($tmp , "$destination$name");	

	createThumbnail($name);

if($upload) {

	echo "<br />";
	echo "[ <a href='../showit.php?id=$_GET[id]'>Retourner ]</a>";
}

Link to comment
Share on other sites

What version of PHP is running on each server?

 

What's the code for the "createThumbnail" function? Most likely you're trying to use some function on your remote hosting that is either disabled, or not available with that version of PHP.

Link to comment
Share on other sites

Fair enough.

 

Also, you may want to turn on error reporting. You probably are getting an error, you just can't see it.

 

Add:

 

ini_set('display_errors', 1);
error_reporting(E_ALL);

 

To the very top of your script.

Link to comment
Share on other sites

it gives this error

Notice: Undefined variable: tn in /home2/gozikcom/public_html/webzik/maison/functions/functions1.php on line 36

 

here is the function code

 

<?php
function createThumbnail($name) {
$destination = "photos/";
$width = 110;
$height = 83;
$thumb = "thumbs/";


require 'includes/config.php';

if(preg_match('/[.](jpg)$/', $name)) {
	$im = imagecreatefromjpeg($destination . $name);
} else if (preg_match('/[.](gif)$/', $name)) {
	$im = imagecreatefromgif($destination . $name);
} else if (preg_match('/[.](png)$/', $name)) {
	$im = imagecreatefrompng($destination . $name);
}

$ox = imagesx($im);
$oy = imagesy($im);

$nx = $width;
$ny = $height;

$nm = imagecreatetruecolor($nx, $ny);

imagecopyresized($nm, $im, 0,0,0,0,$nx,$ny,$ox,$oy);

if(!file_exists($thumb)) {
  if(!mkdir($thumb)) {
           die("Y'as un probleme , essaye encore!");
  } 
       }

imagejpeg($nm, $thumb . $name);
echo $tn;
}

?>

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.