Jump to content

Archived

This topic is now archived and is closed to further replies.

ScottRiley

Settting FTP write permission.

Recommended Posts

Hi, I need to create an upload image system, my code works, and I've managed to allow someone to upload to my FTP server, but in the main directory.  This came about because of an error, where I wanted the file to upload to the '(root)/adverts/images' directory of the ftp.  However, I missed out a backslash, and the uploaded file was saved as 'adverts\imagesfilename.jpg' in the root folder.  I ammended the missing backslash, but now I'm getting a

[quote]Warning: move_uploaded_file(I REMOVED THE DIRECTORY, BUT YOU GET IT, RIGHT?/Winter.jpg): failed to open stream: FTP server reports 530 Login incorrect. in /REMOVED DIRECTORY/fileupload.php on line 4
[/quote]

Now, I believe I need to set write permissions for this folder, but how do I do so, I have unchecked the 'Read-Only' attribute, but, as I assumed, that didn't do a thing, how would I go about allowing write permission to this folder?

thanks in advance.

Share this post


Link to post
Share on other sites
FTP server reports 530 Login incorrect

That looks like you problem.. either it's loggign in anonymous or your username and password for FTP are incorrect.

Think you would get an access denied if it were a problem with writepermissions to the directory.

Regards
Liam

Share this post


Link to post
Share on other sites
Well, I'm logged into my FTP, and it let me upload into the root folder, but it says access denied when it comes to storing it in '/adverts/images/'.  I didn't make any chanes to teh FTP, just the location in the PHP file, should I change the security issues/something of the adverts/images/ file?

Share this post


Link to post
Share on other sites
post your code your folder order looks wrong.


show the url your using ok

Share this post


Link to post
Share on other sites
[code]<?php
$destination='ftp://domain.co.uk@ftp.domain.co.uk/web/southport/adverts/images/';
$destination=$destination.basename($_FILES['imagefile']['name']);
if(move_uploaded_file($_FILES['imagefile']['tmp_name'], $destination))
{
print("upload succesful");
}
else
{
print("Upload failed");
}
?>[/code]

This will obviously be extended to include file validation atc.

Share this post


Link to post
Share on other sites
Your not carrying a password in the destrination..

also if it's a linux server you could ssh in and 'ls-ls' the directory to see who the owner is set as..

EDIT:

$destination='ftp://domain.co.uk@ftp.domain.co.uk/web/southport/adverts/images/';

should be

$destination='ftp://username:password@ftp.domain.co.uk/web/southport/adverts/images/';


Liam

Share this post


Link to post
Share on other sites
So, could I just use my user and passwod for the FTP site, and it'll upload fine, even if someone is uploading from a different computer?  You'll have to bear with me here, I've only been learning a week or so.

Share this post


Link to post
Share on other sites

×

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.