I have a text box on my webpage. Users can input text there which I later process by a PHP file and save on my server.
Does a jquery plugin exists which will upload files for me and when I go back to my webpage I can see the files previously uploaded and can run my previous php file on the contents of any selected and previously uploaded file?
You mean something like this? blueimp.github.com/jQuery-File-Upload/
File uploads are handled server-side, in PHP in your case, not client-side in jquery. You can read about them in the PHP manual.
What you do with them, once they are on the server, is up to you - so you can make your page display previously uploaded files, or process them in some way.
Related
Hi I am wondering if the input field with type "file" is automatically uploading files to the server when there is a file selected by the user.
The thing I want is that a user can select files to submit it and that a PHP FTP connection is established to upload the files.
I am not sure if the browser pre-uploads the files to a temp directory on the server or does it do that only when you hit the submit button?
Because if the file is already uploaded to the server it would be unnecessary to use FTP to upload the file again only to a different location on the server.
Basically what I want to accomplish is something similar to what we transfer does. I believe they are not uploading before the user hits the button.
Can anybody point me in the right direction and provide me with some extra info about this matter. Haven't found the desired information yet.
Thanks in advance.
The file is uploaded only once the form is submitted (in the same HTTP POST request as all other form fields). Why don't you try it, to see yourself?
And you cannot use PHP to upload a file via FTP from a client to a server. That's not possible. PHP runs on the server, it cannot access files on a client's machine. See also:
Upload a local file from application via web server with PHP code to FTP server
PHP uploading file from browser to FTP.
i have a website which is resposive and built mainly for mobile use, Now i want to save a text file to mobile either memory, But from what i have tried it directly saves the file in server. is there a way to save it in mobile memory or giving such patch that it can be saved outside the root directry?
$handle = fopen($backup_name,'w+');
fwrite($handle,$content);
fclose($handle);
echo 'done';
this is what i have checked so far, in pc i can store it any where but i need it to store in certain location of mobile
make .htaccess file inside your downloadable content folder and put below code, Then it will download instead of showing the code.
AddType application/octect-stream .txt
If it is a .txt file you should do like above. You can put any file type by it's extension.
Whenever someone trying to upload a file, php create a temp file for it on our server. However, if I host the form somewhere else (eg. Server #2), and in Server #1 I reference the form using IFrame, does php generate the temp file in Server #1 ??
Reason behind that: I have a sign-up form which allow people to upload files. Sometimes there are hackers trying to upload infected files to our server. (Which anti-virus caught). However, due to this reason, we are hosting the form somewhere else and referencing the page using an IFrame. I'm just wondering if someone upload an infected file, does server #1 get the infected temp file?
Thank you
php will generate the temporary file (for uploading the file) on the server where the php-upload script is running.
I'm trying to set up a file upload for my website but I'm not sure what I'd need to get this to work overall. I'm trying to use Jquery File Upload but I can't seem to get the files to upload to my server. It looks like I might need something else to get it to run but I'm not sure what. Any suggestions?
There are three "sides" to a file upload.
First is client-side: You need to have a form that can upload files (so you need to set the enctype attribute of your form element, and set your action to post).
Second is server-side: You need something that can handle the file upload. Assuming you're using a server with PHP, you can access the file via $_FILES['filename']. Google has a vast array of example for handling file uploads.
Third is server-side (again) - your server must allow file uploads. Not only must it allow file uploads, but it restricts the size of the file that can be uploaded (php config).
However, it looks like jquery file upload has a PHP file handler.
I will sugest you use dreamweaver its easy to use expecially to upload files to the web n you can also see the steps needed in its help content. or you may download an ftp uploader
For image upload we use FILE html controller.
How this html controller able to browse in the local system?
After selecting a file , it will be copied and moved to server location.
If the php is ale to copy the local file and move to server , will it be able to do any other manipulations of that file ? like delete!
What is happening actually on file upload?
The HTML control is provided by the browser. The browser is a local application and has access to the user's file system. The file's contents are sent to the receiving script by the browser using standard methods.
PHP has no access to the user's file system at any point, just the copy provided by the browser. Deleting or even reading files on the user's file system is not possible.
Actually php is not accessing local system. After you choose a file and click upload at upload form. The whole file(not location) is sent via POST request. And php just recieves that POST request with the whole file, and stores at server.