EasyCFM.COM ColdFusion Forums / Tutorial Requests! / delete jpegs from a root folder

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: delete jpegs from a root folder

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

Addos
03-02-2004 @ 6:02 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 44
Joined: Jan 2003

As a beginner to CF I have successfully managed to set up a facility where
somebody can browse their hard drive, upload and insert an image to a folder
in the root directory. I have also set up where the (text) details of the
image can be inserted into the database. My question is that I can manage to
set up a facility where the details in the database can be later deleted if
needed but I can't seem to figure out how to do the same for the image in
the folder in the root directory.

Does anyone know of a tutorial or have any ideas that I can work from? I have read my brains out on this and so far I just can come up with an answer.
Thanks very much
Regards
Brian


maquiladoras
03-02-2004 @ 6:22 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 2073
Joined: Dec 2002

use CFFILE using the Delete action Smile
the problem is is permissions
specially in the root folder, because it needs to have Read, Write, Modify etc, permissions.
and having them on your root folder, is a bad thing

-
"There is no justice, There is Just Us"
-

Addos
03-02-2004 @ 6:33 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 44
Joined: Jan 2003

Thanks maquiladoras,
Can I ask your advice then? As a beginner to CF I wanted to be able to offer a client the ability to insert images into their sites but I also presumed that they should be able to delete these if they wished. The only problem is that these images are inserted into a folder under the root so what is the usual method here.
Thanks a million for you help.
Regards
Brian


CJ
03-03-2004 @ 10:00 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4262
Joined: Oct 2002

why wouldn't you upload their images into a folder named for them?  this way they wouldn't have access to other user's images?



-CJ-
@ #coldfusion/DALNet
http://charlie.griefer.com

Addos
03-03-2004 @ 4:29 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 44
Joined: Jan 2003

Thanks for your reply,
Basically I have been asked to set up a site for a photographer where he can deal with the site himself after I have initially set it up. This way he can add or delete as he wishes. This facility wouldn’t be open to anyone other than the site owner through a login page to this part of the site.
Does this make sense or am I trying to do the impossible?
Thanks
Brian


webedge
03-05-2004 @ 6:12 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 238
Joined: Nov 2002

I the site is ONLYgoing to be accessed by your client then there is no harm in where the images are actually stored.

As CJ has said, for clrity for you, a dedicated images folder would be better. Just make sure that he can't "accidentally" delete any of the other files.

As for the future you will want to consider if any other people will be given access to the system.  You may want to give this due though or even look at sandboxing the CFFILE tag to preven malicious intent.

Don't forget that no matter how good a login system is, it can alwayd be cracked by someone with the knowhow and patience....

Phil

20% Discount for EasyCFM.com users for ColdFusion MX hosting

CJ
03-05-2004 @ 8:34 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4262
Joined: Oct 2002

if it's just going to be one user, it shouldn't be a problem.

you just store the file name in the database, and run a <cffile action="delete" on that filename.

or, you could do a <cfdirectory> with a .jpg/.jpeg filter, list the files returned and let him delete those files only...but you still run the risk of him deleting images that are used in the site itself that way.



-CJ-
@ #coldfusion/DALNet
http://charlie.griefer.com

Addos
03-06-2004 @ 9:21 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 44
Joined: Jan 2003

Thanks very much for all you help. I did manage to get everything sorted.
I'm just a beginner to CF and this sort of help is most welcome.
Regards
Brian


Website Designed and Developed by Pablo Varando.