Page 1 of 1
How come cannot insert image in this folder?
Posted: Mon May 17, 2004 12:12 pm
by teckyan888
Code: Select all
<?php
C:\Program Files\Apache Group\Apache2\htdocs\assign <--This is my homepage
C:\Program Files\Apache Group\Apache2\htdocs\assign\image <--This is my folder to insert image...
$imgf = $_FILES['userfile']['name']; // name of file in user's machine
$fileDir = "image/".$imgf; <--this is my file dir
?>
Any mistake from my $filedir??
how come i cannot insert the image inside this $filedir???
Anyone who know how to solve it???
Posted: Mon May 17, 2004 12:24 pm
by lostboy
Do you have permission from the filesysytem to insert the image?
see
here
Posted: Mon May 17, 2004 12:30 pm
by markl999
Also define 'insert the image'. It looks like it's a file upload as your using $_FILES, in which case does 'insert the image' mean using move_uploaded_file() ? Might need to see that part of the code too

Posted: Mon May 17, 2004 12:59 pm
by teckyan888
Code: Select all
<?php
$imgf = $_FILES['userfile']['name']; // name of file in user's machine
$imgt = $_FILES['userfile']['type']; // type of uploaded file
$imgs = $_FILES['userfile']['size']; // size of uploaded file, in bytes
$imgtf = $_FILES['userfile']['tmp_name']; // name of the file temporarily
// stored in server
$fileError = $_FILES['userfile']['error']; // error code in uploading file,
// 0 - success
if ($fileError != UPLOAD_ERROR_OK)
{
echo 'Error in uploading: ';
switch ($fileError)
{
case UPLOAD_ERR_INI_SIZE:
echo 'File exceeded upload_max_filesize</br>';
ReturnToBack();exit();
case UPLOAD_ERR_FORM_SIZE:
echo 'File exceeded max_file_size</br>';
ReturnToBack();exit();
case UPLOAD_ERR_PARTIAL:
echo 'File only partially uploaded</br>';
ReturnToBack();exit();
case UPLOAD_ERR_NO_FILE:
echo 'No file uploaded</br>';
ReturnToBack();exit();
}
}
else
{
$fileDir = "image/".$imgf; <-----------------HERE
// current folder's sub-subfolder!
// script in htdocs/kokch
// image loaded in htdocs/kokch/imgFolder/image
}
?>
Actually if i put all my page inside HTDOCS and CREATE NEW FOLDER CALLED image,i can insert the image inside the FOLDER........But problem is,When i create a new folder called "assign" and inside the "assign" got a folder called "image"...I cannot upload the image in the "assign/image" folder...Why??
Posted: Mon May 17, 2004 1:05 pm
by lostboy
missing the complete path to the folder outside of the root...