Upload file without form
Yes i used the search button but i just couldn't find the solution i need.
Is there any way to upload a file so that user wouldn't need to press any form buttons?
My first idea was to use CURL but then i remembered that CURL is server sided.
I know it's possible thru Java and/or Flash but is there any way to do that using PHP & OR Javascript?
Edit:
Thanks for clearing this for me but...
But what about PHP based FTP upload?*
No, it isn't. That would have been a huge security hole. Your best bet is really an officially signed(!) Java applet. An unsigned or a manually signed one would still emit scary warnings to the enduser before proceeding.
I have found a solution. Copy does not take local files and the example of submiting the file does not work if it is local. What you have to do is:
file_get_contents("file:///C:\img.jpg")
then write to a text file the contents in the server (for example /uploads/img.txt) and rename to the same extension of the file to see the image.
It really works with any kind of file.
what do you mean without pressing any form buttons ?
well you could do a javascript document.getElementById('FORM_NAME').submit(); if you want some function in javascript to do the upload , where FORM_NAME is the id or your current html form .
but you CAN NOT make your webpage select the file to upload , you have to let the user select the file in an <input type="file"> element .
otherwise use a java applet
Related
I have some report that is generated from a form. I need this form to be saved automatically on the server, on submitting. Is there any way to do it?
I tried researching on the subject, but Google just throws up links where the user gotta input the URL and press submit or such method. As this pdf should be generated and saved automatically after every form submission, I guess the preferable method would be to call a service or such to generate the PDF and then save it on the server. Can you plz give me a walk-through.Thanks in Advance.
I'm working in PHP.
Here is the pdf docs from php.net. It's all there for the taking. Good luck!
PDF - Manual
I am about to embark on the same journey as I need to create a script to turn a document into a .pdf file using PHP. I don't know a lot about it yet, but it does seem possible. Try this link for starters...
http://www.sitepoint.com/generate-pdfs-php/
I want to have a single button that when clicked opens a file dialogue, and then after the user selects the photo they want to upload and the dialogue closes. I want the photo to upload. I cant think of a way of doing this because in the form you cant use both the type = file and type = submit together. Would I need to use jquery to achieve this? Thanks.
Yes, the idea is to use jQuery for the inital part of having a user pick a file to upload... and then some sort of other, server-side language (like PHP,) will actually do the heavy lifting (by actually uploading the file.)
Here's a jQuery plugin that helps you do this:
http://blueimp.github.com/jQuery-File-Upload/
EDIT:
Yes, I believe with jQuery (or some other library... or plugin,) it would be possible to have an event listener (or something,) pick up when a user browses for a file to upload... and automatically starts to upload it once the file has been chosen. But, again, as was said earlier, it's probably safer to take a two-step approach to file uploads for now.
try this
One-Click Upload is a jQuery plugin that replaces the standard file
input element, allowing you to use any link, image or element to be
used for the purpose of bringing up the "file browse" dialogue. It
completes the upload behind the scenes without refreshing the page,
making it less obtrusive and easier to style than a standard upload
form.
To get the upload started the way you describe you will need to use JavaScript. jQuery is a very good library to use to make that process easier, but it is not required.
Hi i have a question that is almost like other questions but with a small but very important difference.
How can i restrict file types for user with a popup showed in the browser.
The standard file input of html can limit that with a command but it does not work in all browser so it is not an option.
I do not want to validate the file extension after the user has chosen a file but before that, when he is choosing.
Founded this http://demo.swfupload.org/v220/index.htm, but it uploads the file after the user has chosen it, i do not want to do that, i want to upload it after the user submits the form.
So the problem looks like this that there are some ways of not letting the user send a not valid file but they are not good because, one is that i validate after the user have chosen the file and the other is that i upload the file before the user submits the form.
I just want a simple thing to not letting to "chose" a not valid file, it does not matter if it will be made with java script or flash, just let it work.
maybe you have some ideas on how to do it because i searched the whole internet and did not found any solution.
Uploadify supports that feature and is very customizable. You should have no problems setting it up in a way that it uploads the file when the user submits.
you can put a condition on the action file of php where all the fields get by submit the page.at that time you can put validation for the file type. if the file type is not as you mentioned then redirect the error message and let user to make try again.
Thanks.
<input type="file" accept="text/html,image/jpeg">
Also: Mozilla`s doc
Not sure if that's what you're after, but Flash FileReference.browse() method has a FileFilter structure as an input argument, and there you can limit the types of files that the upload dialogue will show.
flash.net.FileReference
I wud like to use file upload(ajax/javascript with php) in my form that has other controls also.
when i uploaded an img it displays on the same form with delete option.
if i click on submit it goes into folder as well as database &
if i click on delete it deletes an img....
anybody can help me?pls
u knw gmail file upload exact like that
It boils down to "Don't use XHR. Do use Flash or iframes". There are libraries that will do the heavy lifting for you.
Just use jQuery ajax upload plugin http://valums.com/ajax-upload/. It is actually not ajax, it's invisible iframe, but result is almost same.
For server-side you can use php with gd-library and some simple MySQL queries.
Is there a way to pass a list of files to fancy upload via java script rather then using the browse button and dialog?
http://digitarald.de/project/fancyupload/#docs
Thanks in advance.
You mean that you want to be able to specify an arbitrary path on the user's machine to upload?
Well, for obvious reasons, that's completely impossible.
If you disagree, think about what would happen if a website made a hidden file upload, set its path to "%USERPROFILE%\Cookies\index.dat", or some other path, and submitted it automatically.
What you might want to look into is to use Flash or Java plugins to upload the file. That will provide you the access to UI changes and so on
Example: http://imageshack.us/ homepage.