| | |
problem uploading photo in webserver
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2008
Posts: 217
Reputation:
Solved Threads: 4
i have a script which works as i were using it in localhost(wampserver),for uploading photo in a directory then the file path to the database.
My problem is that now i`m trying to use the script in the website server where i uploaded my site files,and its giving me the errors as below:
Warning: move_uploaded_file(ftp://........../www/photo/uploads/Biboze.jpg) [function.move-uploaded-file]: failed to open stream: FTP server reports 530 Login authentication failed in /home/kislatco/public_html/photo/upload.php on line 16
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpTPTywF' to 'ftp://......./www/photo/uploads/Biboze.jpg' in /home/kislatco/public_html/photo/upload.php on line 16
The directory i were using in wampserver(localhost) is
$uploadDir = 'c:/wamp/www/photo/uploads/';
And in the webserver which is giving me errors is
ftp://......../www/photo/uploads/
So i dont know what is Wrong?any Help will be apprecited.
My problem is that now i`m trying to use the script in the website server where i uploaded my site files,and its giving me the errors as below:
Warning: move_uploaded_file(ftp://........../www/photo/uploads/Biboze.jpg) [function.move-uploaded-file]: failed to open stream: FTP server reports 530 Login authentication failed in /home/kislatco/public_html/photo/upload.php on line 16
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpTPTywF' to 'ftp://......./www/photo/uploads/Biboze.jpg' in /home/kislatco/public_html/photo/upload.php on line 16
The directory i were using in wampserver(localhost) is
$uploadDir = 'c:/wamp/www/photo/uploads/';
And in the webserver which is giving me errors is
ftp://......../www/photo/uploads/
So i dont know what is Wrong?any Help will be apprecited.
Last edited by mrcniceguy; Jan 12th, 2009 at 9:28 pm. Reason: forgot something
have you authenticated yourself before using ftp?
"failed to open stream: FTP server reports 530 Login authentication failed"
"failed to open stream: FTP server reports 530 Login authentication failed"
•
•
Join Date: Mar 2008
Posts: 217
Reputation:
Solved Threads: 4
check my code below and tell where i`m getting wrong:
in localhost i used this directory and it was working
php Syntax (Toggle Plain Text)
<?php $uploadDir = 'ftp://....../www/photo/uploads/'; if(isset($_POST['upload'])) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; ; $filePath = $uploadDir . $fileName; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { //echo "Error uploading file"; $filePath="ftp://......./www/photo/uploads/no_images.jpeg"; } if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); $fileType = addslashes($fileType); } $dbcnx=@mysql_connect('localhost','****','******'); if(!$dbcnx){ exit('<p>unable to connect to the database'. ' this time try again later.</p>'); } if (!@mysql_select_db('register')){ exit('<p>unable to locate the REGISTER DATABASE'. 'AT THIS TIME'); } $query = "update picha set path='$filePath',filetype='$fileType',filename='$fileName',date=CURDATE() where user='peacemaker'";//change query according to you mysql_query($query) or die('Error, query failed'); $path=$filePath; echo "<br>File $fileName uploaded<br>"; include"index.php"; } ?>
in localhost i used this directory and it was working
php Syntax (Toggle Plain Text)
<?php $uploadDir = 'c:/wamp/www/photo/uploads/'; ?>
Last edited by mrcniceguy; Jan 13th, 2009 at 11:56 am. Reason: so.
•
•
Join Date: Jul 2008
Posts: 148
Reputation:
Solved Threads: 25
But what are you using FTP for?
if you're on windows:
If you're on a windows server still, you should have a similiar path to the directory you want to upload the image too.
if you're on a linux server now, you path with be something like:
You dont need to use FTP at all. Just make sure the directory you want to upload the image to, exists and is writable.
if you're on windows:
$uploadDir = 'c:/wamp/www/photo/uploads/'; If you're on a windows server still, you should have a similiar path to the directory you want to upload the image too.
if you're on a linux server now, you path with be something like:
$uploadDir = '/home/user/public_html/photo/uploads/'; You dont need to use FTP at all. Just make sure the directory you want to upload the image to, exists and is writable.
•
•
Join Date: Mar 2008
Posts: 217
Reputation:
Solved Threads: 4
i changed the directory to
And now i`m having the following error,i dont know may be the function move isn`t working
Warning: move_uploaded_file() [function.move-uploaded-file]: open_basedir restriction in effect. File(/public_html/photo/uploads/Naam012.jpg) is not within the allowed path(s): (/home/kislatco:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp) in /home/kislatco/public_html/photo/upload.php on line 16
php Syntax (Toggle Plain Text)
<?php $uploadDir ='/public_html/photo/uploads/'; ?>
Warning: move_uploaded_file() [function.move-uploaded-file]: open_basedir restriction in effect. File(/public_html/photo/uploads/Naam012.jpg) is not within the allowed path(s): (/home/kislatco:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp) in /home/kislatco/public_html/photo/upload.php on line 16
![]() |
Other Threads in the PHP Forum
- Previous Thread: Capturing username and displaying on another page
- Next Thread: Urgent help needed! Transaction process after shopping cart
| Thread Tools | Search this Thread |
advanced ajax apache api array basics beginner binary broken cakephp check checkbox class cms code combobox cookies cron curl database date datepart display dynamic echo email error file files folder form forms function functions google head href htaccess html image include includingmysecondfileinthechain insert integration ip java javascript job joomla js limit link login loop mail menu mlm multiple mysql oop parse password paypal pdf php problem procedure query radio random recursion regex remote script search server sessions smarty smash sms soap source space sql stored syntax system table traffic tutorial unicode update upload url validator variable video web xml youtube





