Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Image File Upload Problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Image File Upload Problem

Postby Mohan » Mon Nov 04, 2002 12:32 am

Hi!
I am trying to upload image file but it is not getting upload. text,html,zip files get uploaded but image file is not getting uploaded. i am using move_uploaded_file() method. Pl. help me.
Mohan
New php-forum User
New php-forum User
 
Posts: 5
Joined: Fri Oct 11, 2002 8:17 pm

Postby DoppyNL » Mon Nov 04, 2002 12:51 am

What is going wrong exactly?
What error message do you get?

We need more info to be able to help.

Greetz Daan
DoppyNL
 

Image Uploading problem

Postby Mohan » Wed Nov 06, 2002 8:23 pm

I am using following code for uploading. Text, HTMl file s get uploaded but jpg,gif not getting upload. So pl. tell me how to do it. - it is even not giving any error also.
code is -

<?
if (is_uploaded_file($users_file)) {
move_uploaded_file($users_file, "/my uploaded folder's path/".$users_file_name);
echo "File Uploaded Successfully!";
}
else
{
echo "File Not Uploaded!";
}

?>

I am new to php. so pl. tell me how to do it.

Mohan
Mohan
New php-forum User
New php-forum User
 
Posts: 5
Joined: Fri Oct 11, 2002 8:17 pm

Postby Oleg Butuzov » Thu Nov 07, 2002 1:29 pm

Code: Select all
copy ($HTTP_POST_FILES['img']['tmp_name'], "newfilename.gif");
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Thu Nov 07, 2002 1:31 pm

sorry may be you will understud better

Code: Select all
$dir="../pic/";

if ($HTTP_POST_FILES['bigimg']['size'] > "8") {

$newcount=file("countbig.txt");
$nextcount=$newcount[0]+1;

$cf=fopen("countbig.txt", "w");
fputs($cf, "$nextcount");
fclose($cf);


$ext=explode(".", $HTTP_POST_FILES['bigimg']['name']);


$bigimg_src="big$nextcount.$ext[1]";
copy ($HTTP_POST_FILES['bigimg']['tmp_name'], $dir. $bigimg_src);


} else { $bigimg_src=""; }

if ($HTTP_POST_FILES['smallimg']['size'] > 8){
$newcount=file("countsml.txt");
$nextcount=$newcount[0]+1;

$cf=fopen("countsml.txt", "w");
fputs($cf, "$nextcount");
fclose($cf);


$ext=explode(".", $HTTP_POST_FILES['smallimg']['name']);

$smlimg_src="sml$nextcount.$ext[1]";

copy ($HTTP_POST_FILES['smallimg']['tmp_name'], $dir. $smlimg_src);
} else {
$smlimg_scr="";
}


this is a part of some old projects scripts...
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am


Return to PHP coding => General

Who is online

Users browsing this forum: TurnitinBot [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.