Jump to content

Show upload files in my browser


johnseito

Recommended Posts

Hello everyone,

 

I have a question with upload files.  I create a html form and php codes to upload files.  I also created a directory called uploads where my php upload files resides.  when I upload it, all the files goes to the uploads directory. 

 

so my question is when I upload can it be save into mysql and then I can bring it out and show it in the browser instead of how i have it in the directory.

 

How would I do this?  I really want to show what I upload in the browser/server.

 

thanks -

 

Link to comment
https://forums.phpfreaks.com/topic/90298-show-upload-files-in-my-browser/
Share on other sites

cooldude832

 

A Blob field in mysql can store up to 4gb of data in binary.

 

thanks for the site

 

Ok if it can store up to 4gb, how can i make it store more if in the end I want to? and I read the site provided by rhodesa, it said blob only stores

 

Since BLOB is limited to store up to 64 kilobytes of data
.

 

 

rhodesa

 

thanks for the site, I will read more about it.

I want to show the files in the browser, the image of it. I created one and it works but it doesn't work for all pictures, it doesn't show all pictures only some. Do you know why that is?

 

I also would like to upload music and ms doc (mostly excel) files, so how would I select these and view them on the browser?

 

An abridged method

 

1) The file is stored in temp, verify it didn't error on upload with the $_FILES['Input_name']['Error'] is empty

2) use the move_Uploaded_file to temporary transport it so you can then get its content use a random name just in case

3) Transfer the now temp file to mysql via file_get_contents, remember to store the file type headers and the extension

4) To recover just insert that content into a new file from a mysql query via echoing the output into the proper header document.

 

Example would be

 

upload.html

<h1>Hello World!</h1>

 

It was uploaded via a form

$temp_folder = "temp/";
$num = rand(0,9999);
move_uploaded_file("UPLOADED NAME", $temp_folder.$num."_".$_FILES['UPLAODED_NAME']['tmp_name']);
#now insert
$q = "Insert into `files` (FileName,Type,Content) VALUES('".$_FILES['UPLAODED_NAME']."", '".$extension."", ''.file_get_contents($temp_folder.$num."_".$_FILES['UPLAODED_NAME']['tmp_name'])."')";
?>

 

Now to recall it you just put it in a doc

 

Very crude but general idea

Hi

 

I just noticed why some picture can't be uploaded, because some of those pictures files size are too large, about 600kb or 1.2 mb.  I currently can only upload about 17 kb, how can I increase this capacity so that I can upload all my pictures?

 

 

thanks

Ok I got that, now a couple of things if you could offer some advice on.

 

1- I have the codes to upload pix and show them in the browser, but in only does it for one pix at a time and the last one uploaded.

I would like to show all the pixs in the database with the last one uploaded showed last, I tried for the past two days to do this but haven't found any

solution.  if you have any let me know.

 

2 - do you know if or the codes to upload music and excel files to the database and show them on the browser?  I was thinking that maybe I should do it as I

did it for pix and change it to xls for excel docs, etc. 

 

thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.