NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Mike Grigsby 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,
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
-
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.
-
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
-
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?
-
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