NetTalk Central

Author Topic: File Upload - removing images  (Read 4898 times)

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
File Upload - removing images
« on: September 01, 2009, 01:47:06 PM »
What am I missing here? I allow the user to upload a file, and the moment they hit the field, a popup comes up to allow navigating to the folder and file they want to attach to a record. However, there doesn't seem to be a way to remove the image from the field (after saving and re-editing the record after it was saved).

How do I let the user remove the photo after it has been uploaded? Also, why doesn't the string field show the path to the file? I am using the interception method of attaching the raw date and time to the file name to ensure there are no duplicates in the uploads folder, but that shouldn't matter, should it?
Mike Grigsby
Credify Systems
Central Oregon, USA

Rob Mikkelsen

  • Full Member
  • ***
  • Posts: 107
    • Yahoo Instant Messenger - flashpott
    • View Profile
    • Email
Re: File Upload - removing images
« Reply #1 on: September 01, 2009, 04:41:34 PM »
Mike,

When a user uploads a file, I immediately copy it to a folder with that user's ID and log it into a tps database that contains the real filename as specified by the user, and the new filename because I rename each file with a sequential number.  As part of the upload process I reduce the size of the photo to display on the screen and I create rhe thumbnails at the same time..

A user can view the thumbnails and see the original filename in a browse procedure, and delete or view the file if desired.  On the record delete, I look up the actual name of the file and delete it and the thumbnail from the folder, then remove the log entry that contains the relationship between the name the user knows and the name that I have given it.

There is no simple form entry to delete a picture, nor do I believe should there be.  You could set up a text window and then use the text returned to delete the file, but that sounds like it could be a bit dangerous.

Cheers!

Rob

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: File Upload - removing images
« Reply #2 on: September 01, 2009, 08:24:54 PM »
That sounds a bit complex for a consumer-ish type application. Assume for a moment that the application was like this site, where a user goes to upload a photo. What would they do to delete the photo? That's sort of the scenario I'm working with. It can't be too complex. Even this application has a no photo selection. There should be some sort of built-in remove functionality. That is just my opinion. Sure I can code something, but that doesn't seem reasonable long term.
Mike Grigsby
Credify Systems
Central Oregon, USA

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: File Upload - removing images
« Reply #3 on: September 01, 2009, 11:40:01 PM »
If they were uploading photos to a site, then presumably you're gonna display the photo to them at some point?
The delete functionality should be there, with the photo where it is displayed, not on the "upload a photo" form.

So maybe you put a delete button on the form (so they can "update" a photo)
or more likely you put a delete button next to the photo in the browse, or whatever.

Cheers
Bruce

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: File Upload - removing images
« Reply #4 on: September 07, 2009, 09:07:04 PM »
Sorry to be an ignoramus on this, but if I'm deleting a record from the browse, what is the proper place to inject the code to delete the files? In the form's Routines | Post Delete?
« Last Edit: September 07, 2009, 09:21:34 PM by Mike Grigsby »
Mike Grigsby
Credify Systems
Central Oregon, USA

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: File Upload - removing images
« Reply #5 on: September 08, 2009, 03:30:01 AM »
Yes Mike,
To delete the file, add your code in the PostDelete embed.
Besides , if your user can change the uploaded file, then, may be, you need to delete the last one.
Then you can save the filename to delete in the PreUpdate embed and then delete it in the PostUpdate.
Hope this helps,
Alberto
-----------
Regards
Alberto