take screenshot from a uploaded file with php - php

I'm continuing with my script to upload files, so on a html form, it askes to upload a file, and then there is a table where I can view the file as it is save it in the db (well, it saves the path) and I was wondering... is it possible to take a screenshot of the file I'm uploading to show it on an html table?
I mean... is there any php function which takes an screenshot/image of a file?
Thanks!!

Related

File remove from selected files while multiple file upload in php

Is there any process to remove file content while files are selected for upload using multiple file upload and update form after remove file to send data another php page with ajax call function. I am novice in file multiple file handling.
if i understand your requirement - you cant change anything in file ( image ) before uploading to server.PHP works on server not on client side OR Please explain your requirements.

make a php file write into mysql before processing the uploaded file

As of now I have first code that inserts into a table, then
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'][$key], $tp)) { }
I am trying to read the inserted record outside the actual file upload handler as the upload is in progress with javascript. It seems that the record gets inserted only after the file has been uploaded.
How to prevent this by allowing a write to mysql and then initiate the upload progress.
Useful for uploading large files, I am trying to let the person set information about the uploaded file as the file is uploading, have developed a beautiful progress bar with php 5.4 using upload_progress_key and so, but the problem is I can't get to know if the file information is on the database to allow for editing custom parameters set by the user.
Thanks for the first down vote here, appreciate it.
THIS IS WHAT I DO:
mysql_query("INSERT INTO TABLE VALUES VALUES");
GREAT so far,
NOW
move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $dest);
The problem is while trying to read as a 700mb file is being uploaded at file_upload.php
read.php contents:
mysql_query("SELECT * FROM table WHERE values="values");
RETURNS 0
up until the uploaded has fully finished and now it returns 1.
So what does it have to do with move_uploaded_file()
and mysql_query("INSERT INTO");
that although on the syntax is first written mysql_query("INSERT INTO");
it appears that this is not happening up until the file gets fully uploaded to the server.
File uploads in PHP work like this:
user selects file to upload in browser, submits the form
the browser uploads the form, including file, to the web server
the web server writes the received file to a temporary location
when the entire upload is finished, the web server initiates the PHP script
In other words, by the time the PHP script is run, the upload is already long finished. move_uploaded_file just moves the file on the server's hard disk, it does not initiate the actual upload, as you seem to assume.
If you want to do anything before the file upload, you'll have to make an AJAX request to another PHP script or otherwise communicate outside the request cycle in which the file is being uploaded.

ajax upload image and send data

I have html form with lot of textboxes, and three optional image uploads.
How can I make ajax:
1) Saves the pictures in the server folder [example: ./MyImages]
2) When pictures are saved, their URL's and all other textbox data is saved to mysql.
thank you
You can use Ajax Form to post the data and the files using ajax.
Then in your php file you can save the images into a directory, see : move uploaded file then save the file names to your db.
So you can reach the url's using your website url, directory name and file name.

Browse directory files and pass url to PHP, or upload and pass URL

I've been searching for a good 3 hours, and I'm stumped on how to do something I think is pretty simple (famous last words...)
Basically, I'm building a site that allows the user to upload a pdf file. The URL of this file is stored in a database, along with the name and a few other details. I am trying to work out how to either:
-Provide an "upload" box/button/area that a user can select a file, upload it, and then have the URL of where the file was uploaded stored in a database.
OR
-Use a separate upload script, and have the user upload the file. Then, (on a possibly separate page, I don't mind) provide a file browser, which would allow the user to browse a directory, and select a file, with the url of that file passed through to the PHP form.
I don't mind which way it is done, as long as the desired outcome of having a file uploaded and the url added to a database.
Or am I out of the reach of PHP? Is my best bet uploading files via a bare php uploader, then manually entering the url of the file uploaded into a textbox on a php form?
Any help is much appreciated!
create a htmlform, make sure to set enctype to a value of
"multipart/form-data"
in PHP you should be able to get the file namefrom the $_FILE global variable
save it to a directory on the server.
the url of your document will we http://serverroot/{directory name}/filename.pdf -> directory name is the name of the directory on the serve you saved the file in

How can a user upload a résumé in Word or other common format and have it uploaded into my DB in PHP?

How does résumé upload work? I have a site in PHP and right now users can build their résumé line by line, because it is stored in db table. How can a user upload a resume in Word or other common format and have it uploaded into my db? Is it something to do with regex? Are there any scripts out there available that can do that?
Just trying to understand the process.
Thanks.
UPDATE:
BTW I looked around a bit and saw web-forms for resume creation -- I already have that. I need a user to be able to point webform to his/er resume, click SUBMIT and have that document input into db automagically.
Simply use the file uploading feature:
create a HTML page containing a <form> and a file input.
create a PHP script that receives the uploaded file
The process is simple: user selects a file to upload and the browser sends it to a PHP script designated by the action attribute of the <form> tag. After the file is uploaded into the server, you can do whatever you want with it.
PHP file upload tutorial
File uploading guidelines in PHP manual

Categories