ok well i have a small problem with upload file, i have code which works fine...
but the design on my website the form which has the browse button to add the file is on page one, but i only want to upload the file on the third page when everything has been confirmed.
HTTP_POST_FILES must store an array of values and i do not know what to pass to the last page to make it upload the file correctly. hopefully the code will make this easier to understand.
as you can see ive tried just using the url as $source, but this didnt work!!
think it has size, and a couple of other variables.. if i know these variables maybe i can pass these to the last page via hidden txt boxes.
any help much appreciated!!! thanx in advance!!!
![]()
PHP Code:
$uploadpath = '';
$source = $HTTP_POST_FILES['userfile']['tmp_name'];
$Item_ID = '786';
//$source = 'H:\Project\htdocs\Final_Project\pictures\6824.jpg';
$dest = '';
if ( ($source != 'none') && ($source != '' )) {
$imagesize = getimagesize($source);
switch ( $imagesize[2] ) {
case 0:
echo '<BR> Image is unknown <BR>';
break;
case 1:
echo '<BR> Image is a GIF <BR>';
$dest = $uploadpath.$Item_ID.'.gif';
break;
case 2:
echo '<BR> Image is a JPG <BR>';
$dest = $uploadpath.$Item_ID.'.jpg';
break;
case 3:
echo '<BR> Image is a PNG <BR>';
$dest = $uploadpath.$Item_ID.'.png';
break;
}
if ( $dest != '' ) {
if ( move_uploaded_file( $source, $dest ) ) {
echo 'File successfully stored.<BR>';
} else {
print("'"); echo $source; print("'"); echo $dest; print("'");
echo 'File could not be stored.<BR>';
}
}
} else {
echo 'File not supplied, or file too big.<BR>';
}
?>





Bookmarks