ScottRiley Posted August 10, 2006 Share Posted August 10, 2006 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 https://forums.phpfreaks.com/topic/17112-settting-ftp-write-permission/ Share on other sites More sharing options...
shocker-z Posted August 10, 2006 Share Posted August 10, 2006 FTP server reports 530 Login incorrectThat 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.RegardsLiam Link to comment https://forums.phpfreaks.com/topic/17112-settting-ftp-write-permission/#findComment-72386 Share on other sites More sharing options...
ScottRiley Posted August 10, 2006 Author Share Posted August 10, 2006 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 https://forums.phpfreaks.com/topic/17112-settting-ftp-write-permission/#findComment-72387 Share on other sites More sharing options...
redarrow Posted August 10, 2006 Share Posted August 10, 2006 post your code your folder order looks wrong.show the url your using ok Link to comment https://forums.phpfreaks.com/topic/17112-settting-ftp-write-permission/#findComment-72388 Share on other sites More sharing options...
ScottRiley Posted August 10, 2006 Author Share Posted August 10, 2006 [code]<?php $destination='ftp://[email protected]/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 https://forums.phpfreaks.com/topic/17112-settting-ftp-write-permission/#findComment-72391 Share on other sites More sharing options...
shocker-z Posted August 10, 2006 Share Posted August 10, 2006 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://[email protected]/web/southport/adverts/images/';should be$destination='ftp://username:[email protected]/web/southport/adverts/images/';Liam Link to comment https://forums.phpfreaks.com/topic/17112-settting-ftp-write-permission/#findComment-72394 Share on other sites More sharing options...
redarrow Posted August 10, 2006 Share Posted August 10, 2006 i recon it's windowsyou got to add the username and password Link to comment https://forums.phpfreaks.com/topic/17112-settting-ftp-write-permission/#findComment-72398 Share on other sites More sharing options...
ScottRiley Posted August 10, 2006 Author Share Posted August 10, 2006 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. Link to comment https://forums.phpfreaks.com/topic/17112-settting-ftp-write-permission/#findComment-72401 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.