check contents of a html file, PHP - php

i have a Laravel project upload form on my server that users can upload their html files.
i need uploaded files to be no threat on my server. and check their contents.
but is there any other ways to help me secure this order to find tags like <script> or <?php

Related

Is html input field with type file, uploading automatically or not?

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.

Basic steps for setting up file upload on website

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

jquery file upload plugin which remembers the previously uploaded files

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.

PHP - File upload - What is happening internally?

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.

Uploading images from server using Php

In my php application i have a folder in which all the photos are kept.
The images are in different sizes.So i want to select photos from the folder and applying some image functions and upload to a different folder through php code.
This is same as image uploading but the difference is that the source file is in server
That is i want to select photos from server applying some image functions and upload again on the server
Pls help me
If you want to keep them on the same server, no further uploading is necessary. You can just perform whatever manipulations you want (resize, etc.) then use PHP's filesystem libraries to move the files around on the server. Check them out here.
maybe with curl http://www.askapache.com/htaccess/sending-post-form-data-with-php-curl.html here a tip explaining how to send data with curl
If you select a photo from the folder and applied some image functions, instead of saving the file back to the original file, you could simply save it to it's new location...
In that case you don't need uploading and/or moving...

Categories