I am wondering if there is a way to have a file input field start up with a file pre-loaded in to it.
For example I have a test file on my server - 'test.txt'
When the user opens the page, I want to have test.txt already loaded in to the input field so all they have to do is fill out the text fields and hit submit
Imagine it was possible. Then you could hide the input field using css and steal any file you wanted ;-)
Apparently a large security risk and browsers prevent against performing such a task.
Related
Abstract Question here I guess
I have an idea for an app that parses .txt files and outputs info based on what is contained in the file. My question is how would I go about getting the text file into my app for example if the text file was attached to an email?
This is the only hurdle I have to get clear in my mind before I begin.
So here's a real life scernaio -
I have email with text file, I want to open my app and say import file.
I need to get that text file from my email into the app so I can manipulate it.
Not sure this is possible, hopefully somebody can let me know or suggest a workaround.
Thanks in advance!
Register your app to open a particular file type and ensure the attached file is identified as one of these file types (i.e. using mime type). You will probably want to use a unique file extension, other than .txt.
I am looking to facilitate the users of my website with a google-doc like text editor, where the user can write and format text in the context of an A4-page rather than a HTML textbox, which can be saved on server later on.
The idea is that, later I can proceed to print the file on server-side, without asking the user to go through the File->Print from his browser and then re-upload the locally saved PDF, instead I would generate a printable format of the input.
A simple WYSIWIG editor won't do I believe, as it will not be able to edit address fields inside it, but feel free to prove me wrong!
Thanks!
I am using robotframework ,selenium2Library, selenium2 and python27 to test web program. It need to upload a file in my web program. I use Choose File to give file path value to input filed. But it is not work for firefox and it works fine in chrome. When I upload file manually in firefox, it works. It is a register page. Javascript code told that file upload field is empty when the form is trying to submit, since selenium seems did not give the file path to the value of file upload field. And other input fields all have been input values, no matter fields before this file upload filed nor those fields after it. Does anyone know how to solve this problem or is there any alternative solutions?
I've had success having selenium type the file path into the webpage directly. It works most of the time, but the site I use it on is being constantly updated and one week you can type a file path, the next week you can't, the following week you can again.
I say this as a precaution that this may not be the ultimate solution, but there are instances where it works. Your particular case may be able to use this method.
driver.find_element_by_name("FILE_UPLOAD_ELEMENT_NAME").send_keys(os.path.expanduser("~/PATH_TO_FILE"))
Feel free to find element by any other characteristic and replace the all caps parts be appropriate for your use.
I have a form in ZF2 where, for example, a text box and a file input box are included. What about when the form is not valid because the text box, for example, is required and user leave it blank, how can I save on the form the previously uploaded file so that it will not be uploaded again and again when the form is invalid?
Regards,
Eli
As of ZF2.1 (I think), there is support for this via the post-redirect-get plugin. The relevant documentation is here:
http://zf2.readthedocs.org/en/latest/modules/zend.form.file-upload.html#file-post-redirect-get-plugin
When you cannot separate the forms, the File Post-Redirect-Get
Controller Plugin can be used to manage the file inputs and save off
valid uploads until the entire form is valid.
You could use Validation groups to validate the none-file fields separately from the file input fields:
http://framework.zend.com/manual/2.0/en/modules/zend.form.quick-start.html#validation-groups
I am trying to have two different .pdf forms, and when I check a box in one it will show in the other, then when all the boxes are checked it will check another box in the second .pdf.
How would I do this?
I believe you will have to write some javascript code inside your pdf files. This will do the job for the first case, but I am not sure if Acrobat Reader will allow you to do modifications on an external file from javascript... If it does allow you, I would consider it a security hole.