Jump to content

Settting FTP write permission.


ScottRiley

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.
Link to comment
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
Link to comment
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?
Link to comment
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.
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.