Should I upload selected files before the user submit the form? - file-upload

I'm sorry for my english.
I have a question, I have a form that contain a file input and other text inputs, when the user selected an image and filled other inputs in the form , should I upload the file to the server before user actually hit the submit button, or when he hits the button. If I should upload the file before then how I gonna clean up the unnecessary files if the user doesn't complete the form and didn't hit the submit button or he close the browser before submitting the form .
Sorry again for my english

Both are OK, depends on the business logic.
For better UX, upload it before feels much faster, but in the other hand, much more complex to develop. On the backend side, for example, you might have a cron job to delete all images that was upload and not used(eg: user left the site). Also in some case you need to create the form first to get it's ID.
By uploading when the user click the submit button, is much easier to develop.
If you are new, i'd recommend to upload only when the user click on the submit button.

Related

Disable user from saving .aspx content from browser by using "saving as" option

I have a .net website.
I need to disable the save as option from browser so that the user cant save some of the website pages in order to protect their content.I did disable right click.But user can select save as from browser's menu.
Is it possible to do that?
It is difficult to lock down a website by disabling the save button. What is to stop a user just copying the text and pasting to another document. Right clicking an image and saving. Then there are differences between browsers etc. If you need to protect you information you may need to look at creating and displaying PDFs but this is also not an easy thing especially if the site is dynamic.
What you want is impossible. If the user is able to read the information on his/her screen, there is always an option to copy the content.
How would you stop the user from taking a picture from his/her screen with a digital camera for example?

How to send textfields content via email in the background?

I'm trying to make a simple view based application.
I want to receive information with the content of text fields when user filled text fields and hits the submit button.
The way I do this doesn't matter so much. It can be done by sending information to a web server or sending information to my e-mail in background. Actually it seems easier to do it via e-mail.
I just want to know what the user wrote on text fields when he hit the submit button.

What is an alternative to nesting remote forms in rails?

I have a User that can have multiple images. I would like to allow the user to add images while updating their user page and have those images dynamically updated so that they can see the images on their profile as they edit it. I currently have the images set as sortable using jQuery-ui. I would like the user to be able to add images, sort them, and edit their profile info and only need to click the submit button once.
I know that it is not possible to nest remote=>true forms and do not believe it's possible to submit files via ajax. Is there some other way this can upload the files and then use jquery to append them back to my div?
Unfortunately, from a user experience standpoint, the image section makes the most since being pretty much in the middle of the form. Moving it to the top or below the original form is less than ideal. I might be able to use CSS to make the remote form appear as if it is middle of the parent form, but this seems like a pretty bad solution.

How to get Multiple Inputs

I was thinking of implementing picture uploading to my web application.
Now there are few Uncertainties.It would be great if some one makes them clear.
How do you allow user to upload multiple data for
Example. I have a model for car and I want user to add as many pictures with comments. Usually on websites there is button that says "Add another picture". If user clicks that button or link a text field and a Browse button appears and user can add as many pictures as he wants.
You need to go through this wiki -
http://www.yiiframework.com/wiki/176/uploading-multiple-images-with-cmultifileupload/

ASP.NET Keep fileupload after postback

I'm writing an intranet ASP.NET page using VB.NET. I've run into a particularly nasty problem dealing with handling file uploads. I'll do my best to explain the problem, and perhaps someone can help.
My problem is almost a duplicate of this one, or this one, except (other than the filename) I don't care about sending the file to the server until the other data has been reviewed.
Here's the situation:
Joe Q. Dataentry inputs some data into several fields. The first 3 are drop down, and when he changes the selection, a postback event is fired that queries a database for valid entries for the other drop down selections. After selecting the values, he inputs some other data, chooses a file to accompany the data and clicks the "Update" button. When he hits the button, it fires a postback event that sends the current data to the server to be validated. The data will create a change in the database, so he is presented with a view of the current state, and what it will look like when his changes are made. He can now either confirm or cancel the operation for whatever reason.
Part of the data he will see involves the extension of the file which may be a PDF, or could also be some image file or other document.
Now here's where my problem is - on each postback event, the fileupload dialog is cleared. I was getting around it by creating a temporary file on the first postback and then renaming if he clicks OK or deleting on Cancel... but I need to do a variety of things, based on the previous state of data and the filename. I've tried to keep some session variables to retain the filename, and that works OK for just renaming the file, but for what I need to do it gets unwieldy.
What I want to do is be able to have the postback event to present the changes, and then when the user clicks "OK", submit the file. Is there any possible way to do that?
One of my thoughts was to do some of the validation client-side (I'm already re-validating server side so I'm not too worried about data security there), but I don't know how I could get the information from the database query.
Thanks for any help, and reading my slightly convoluted story/situation!
EDIT:
It appears that what I want to do is prevent a certain button from firing a full postback. Is there any way to do that?
EDIT II:
I have an update panel on the page already - is there any way for the button to only post what's in the update panel?
What you might want to do is place your drop-downs inside of an ASP.NET AJAX UpdatePanel, and keep your file upload control out of that.
Your update panel will do the post backs and allow your validation logic to happen without submitting the file, then when you hit your final "Save" button (which is also outside of your UpdatePanel) the entire form will be submitted back and you can work with your file then.