Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Can You Upload Images Directly To MySQL?


Well i was just wondering if there was any way to actually upload the image to the database, and opposed to putting the image somewhere else and recording its url and other info in a table.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How Do I Upload Images To Mysql? And Retreive Them?
Can someone please tell me how to upload images to mysql database using php, and then retrieve and view them?

How To Upload Multiple Images To A Mysql Database?
ive been looking for a tutorial or a snippet of code that would allow me to go to a browse button, navigate to a directory, and either upload everything in that directory or let me select what ones to upload, all i have been able to find are multiple inputs and each image needs to be uploaded individually.. Anyone seen anything like this before?

Upload Multiple Images From A Folder At A Time And Watermark The Images
I have a problem with uploading multiple images from a folder at a
time with a single mouse click and water mark the images with text.
Can any body please help me with code and suggestion about this issue?

Stream From FTP Directly To MySQL While Parsing CSV
I have some files that sit on a FTP server. These files contain data
stored in a tab-separated format. I need to download these files and
insert/update them in a MySQL database. My current basic strategy is to
do the following:

1) Login to the ftp server using the FTP library in PHP
2) Create a variable that acts like a file handle using Stream_Var in PEAR.
3) Use ftp_fget() to read a remote file into this variable (this is so I
don't have to write it to disk).
4) Parse that data now stored in memory using fgetcsv() (again treating
that variable as a file handle using Stream_Var). This produces an array.
4) Insert/Update the data in the array using DB in PEAR.

This all seems to work and it means I don't have to write anything to
disk. Everything is handled in memory so not temp files are needed. The
downside is that some of these files are very large so the program can
consume large amounts of memory. I want to see what I can do to reduce
this memory usage.

In a perfect world I don't need to keep the entire file in memory. As
soon as a single line is read via FTP I should be able to pass that line
off to the CSV parsing code and the MySQL insert/update should be able
to take place as each line is parsed by the CSV library. I.E. I should
have more than a buffer worth of data in memory at a time. A buffer
would need to be able to store at least a entire line but my memory
requirements would drop significantly.

My problem is that I can't seem to be able to figure out how to do this
with the current PHP libraries. It seems that most functions in PHP are
not designed around the idea of piping streams of information together.

The other restriction I have is that I am limited to just PHP 4.3. Any
ideas or is holding the entire file in memory the best way (other than
writing my own libraries).

Can I Put A Mysql Query Result Directly Into A Multidimensional Array?
I have two joined tables:

Departments - which contains the department description and a key
Positions - which contains position data

What I'm attempting to achieve is to display the department title in one table cell and then list all the positions associated with that department in the cell under neither the title. I need to generate a table two column table with as many rows as required, depending on the number of departments, which is dynamic.

Do this I'm trying to turn the result of my SQL query into multidimensional array e.g. dept = VioP positions = "designer", "engineer" etc, which I can do then use to generate the table.

I've done a search on the forum and looked around the manual and I'm stumped on how to achieve this, a point in the right direction would be greatly appreciated. The query I'm using is below. PHP Code:

Upload Images W/out Ftp
Can someone point me out in the right direction for uploading images without using ftp?

Using IIS, PHP 4.0.4pl1 more info: 3 file input boxes, on submit updates a file, and i would like it to upload the files specified in the 3 boxes. form is as follows: Code:

<FORM ENCTYPE="multipart/form-data" ACTION="<?=$PHP_SELF?>?mode=submit" METHOD="POST">
<text input blah blah blah>

<INPUT TYPE="FILE" NAME="fileupload1" SIZE="25">
<INPUT TYPE="FILE" NAME="fileupload2" SIZE="25">
<INPUT TYPE="FILE" NAME="fileupload3" SIZE="25">
<submit></form>

how can i have it save the binary info from the images to a file on my server?

PHP Upload Images Without FTP?
I am currently using my computer to test my server and they consist of Apache, PHP and MySQL.

I want to allow people to upload images on to the site. The path of the image will be store in a database, together with all the other infomation regarding the pictures.

How do I do the upload with PHP when I do not have FTP? I read somewhere you can use streams to upload on to the server but I have no idea how. Or should I just install a FTP? If so, how do I install an FTP on my computer.

Upload Images
I am not an experienced PHP programmer and have look on the net for
what I want to do.

I'd like to allow the user on my website to upload two images one is to
be turned into a thumbnail and one is to be turned into something of
around 500 x 300, one stored in a thumbnail folder and one stored in an
image folder.

I can do it individually from different pages but not from the same
form.

Upload Images
I have this code that works good, just have to implement some filters. How would i change this code if i wanted to add 3 images instead of just the 1.
I have input fields and fields in my database called photo1, phot02 and photo3. Code:

Upload Jpg Images.
is ther any idea how to upload jpg images. Let say for exmple, I have a text box and browse button.After  i click the button that says upload the image will upload. Then when i click the button view the images will view. How can i do that? I need your help... pls send me a codes for that...

And also i have a question uhmm... where is that images save? is ther a folder that all images will save or the images will save on the dbase?

How To Upload Images To Serevr
how can i upload images to server which are seleceted from a client on
his machine.

HOW TO UPLOAD Images To Web Server
vishal here. i am creating a page where the user can post their
advertisements. if the user want to put some pictures then also they
can put but i don't know how to do this?

so tell me how can i solve this problem.

A Safe Way To Upload Images?
Is there a safe way to upload images? Usually I would have to CHMOD the upload directory to 777 but I quickly stopped using this method because anyone can upload anything.

Previewing Images Before Upload.
I am designing a system where I will be able to enter some text and stuff plus a couple of images in a form, and then submit this form while uploading the images to my webserver.
Ideally though I would like to be able to preview all elements before committing them to the webserver. 'Text and stuff' by themselves would be fine but when coming to images I know there are problems. Correct me if I'm wrong but you can't pass a 'file' from one form to another which to my current way of thinking would happen with a preview function:

enter info -->
submit form for preview -->
view preview -->
submit 'hidden form' -->
enter info to database and upload images.

does this make some kind of sense? I chose this flow as I can look at the local copy of the image before I upload which I think would be wise as I only have a modem to upload through. A way round it would be to upload the image anyway, do the preview and then delete it again if it was the wrong one... over my modem though this would be a lengthy process.

At the moment I am tinkering around with some Javascript which might enable me to do the preview without submitting the original form( I'm not a Javascript coder so this might take some time)... Any other ideas out there?

Upload Images With Names
Is there a way that I can upload an image to a directory on my website and have the image name recorded into a database field without having to create a separate field for that name?

Upload Images Along With Other Info
I'm trying to build a form that has you upload images along with pieces of info (name, phone, etc.). The client sent a link to a site that does what she wants hers to do for the most part. The form that comes up after doing that is what i'm being asked to mimic and since i have very little knowledge of php i have no idea where to begin with so much as finding a tutorial for it.

PHP To Resize Multiple Images, After Upload
Some guys with a website have asked me to present their uploaded images on their site as resized thumbnails with correct aspect ratio. So they upload their images as 680x400, and then a php page calls a mySQL table which has the names, paths and details of the images stored. The images (6 per page) are then presented on the page using simple html .

<img src=whereever width="160" height="120" /> But the images are very "blocky" or "pixelated" on the page I've seen some solutions that use the php header function, which works fine with 1 image, but if there are multiple images, i get errors.

Upload And Resize Multiple Images
Ive got this script for upload and resize pict. But! What if I want to upload 2 images in same time? Code:

Upload Script Works For Images But Not Mp3
My below code works perfectly fine for uploading images. But when I change the file type to audio/mpeg for mp3s does it does not work. Code:

Upload Images From A Mobile Phone
Is there a way of using PHP to allow people to send pictures taken on their mobile phones to an e-mail address, with those images then being saved on a web server?

I've downloaded a pop3 class (pop3.class.inc - some of you may have heard of/used it) which downloads e-mails. However, I can't seem to extract attachments using it and can't find a tutorial.

Newbie With Multiple Images Upload Question
i have this code
foreach ($_FILES["images"]["error"] as $key =$error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["images"]["tmp_name"][$key];
$name = $_FILES["images"]["name"][$key];
move_uploaded_file($tmp_name, "images/$name");
}
}

and i wish to add it a uniqid to every file uploaded leaving intact
it's original name as well. and i would also need to get the file name
and add it to my database.

Broken Upload Form With Images And Fields
It uploads the images, but not to the made directory called $name, and it inserts all SQL fine, just the upload to the specific directory isnt working? Code:

Printing Directly From PHP
Currently I work in a school and I wish to build a PHP/MySQL portal which allows teachers to enter student exam marks online through the portal.

The same site will provide reporting etc. and prints the result of each student on a separate page, which can then be sent by post.

In order to print the results I wish to create a print button (or something similar) which once pressed, extracts the individual student details from the Database and sends them directly to the printer without outputting anything on the screen. IS this possible with PHP?

Run Php Directly At Shell
how to config the linux to know the path of /usr/bin/php so no need to type
it before running a php script every time?

Streaming Content Directly?
Could someone tell me if there's a way to filter & stream the content of a different site directly to someone's browser (without redirecting the user to the other page)?

Right now, I'm accessing my friend's site, filtering the data, and putting his content on a part of my page. I'd like to know if there's a way to speed this up. Saving his files to my host and then sending the data out again is taking more processor power than I'd like to be using for this task.

Reload Image Directly
I am uploading a new image to my database. The upload works ok and the new image is stored ok on server. The problem is can I force a reload on cache to display the new image. If I reload the page it works fine but if i dont then the old image is displayed.is there a way to force a reload of image.

Printing Directly And Emailing
i have a registration web page....on the last page i give out all the information of the registration (student ID, course ID, Name etc etc...) now what i want to do is ....Email all that information to the email of the student (which he/she has provided earlier in the registration process) and also let them print out that information "with a printer friendly page".

Can Php Read .xls Files Directly?
I'd like to be able to read a microsoft spreadsheet with php. I know that php can read mysql, so I was thinking that maybe it could read excel spreadsheets as well.

Does anyone know if that can be done?

Sending Attachments Directly From Form
I have a form with a normal upload type form item, now when this form is submitted I want to attach it to an E-Mail, and then send it out.

What do I do in the PHP form processing code to do this? Obviously I would use MIME mail, but what is the easiest way for me to do this.

Specifically this is for attaching a Resume to a job application that will be sent to an E-Mail address immediately. So the file types will be the normal, '.txt', '.doc' etc.

PHP To Reading Directly From ISAM Files
Are there any utilities that would allow me to use PHP to read directly from an ISAM file?

I have a customer who's application uses keyed ISAM files, but there is no ODBC driver available. We don't need to have writing capabilites, just reading.

There doesn't appear to be any native support within PHP, so I am hoping to find a utility that I could modify for my purpose.

The thought of writing something in PHP using direct file access commands (fopen,fread, etc) is a bit intimidating ! Perhaps someone knows of a "tutorial" on this ?

Cannot Access Session Variable Directly
Basically, a variable called $city_code is passed through the URL and picked up in the script. If that $city_code has not been set as a session variable, then I want to set it.

For some reason I cannot access that city_code directly. So, if the city_code is SIN, then I want to be able to access it as $_SESSION['sin']. However, I can only access it as $_SESSION[$city_code].

I have included 2 echo statements in the script to show where it went wrong. The echo $city_code returns SIN. However. the echo $_SESSION['sin'] just returns Notice: Undefined index: sin.

I should also point out that the script actually does what I want it to do, just that I cannot access the session variable directly. (say $city_code = 'sin') PHP Code:

Outputing Image Directly To Browser
can one "stream" image data to a browser?

I created an image using gd and when I do imagepng I just get the binary
data for the image written as text instead of the image itself. Now I'm
writing the file to a temp file and using html to load the temp but seems
like a waste of cycles and space ;/

Anyway around this?

Security Alert! The PHP CGI Cannot Be Accessed Directly.
I have installed php4.2.2 using the windows installer but i am having problem. I get the message:

Security Alert! The PHP CGI cannot be accessed directly. This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

Referencing Returned Objects Directly
Is it possible to directly reference an object that is returned by a
function in PHP?

ie this:
echo ReturnAnObject()->SomeMember;

instead of this:
var $Object = ReturnAnObject();
echo $Object->SomeMember;

'cus I can't work out the syntax if it is. :-(

Running A PHP Script Directly From The EditPlus Editor
I recently installed both the PHPDEV2 package on my Windows 98SE Pentium 2, and I started writing PHP programs using the EditPlus Editor.

Somewhere I read a comment about the possibility of running PHP scripts directly from the EditPlus Editor, but the writer (I forgot who it was) didn't tell how to do this.Can anybody help me with this? I hope this is not a trivial question, so that more people will profit from the answer(s)!

Mysql And Images
I have a couple questions and I am wondering if anyone could point me in
the right direction.
What I want to do, is the following...
Upload an image (most likely jpeg), display it and store it in a mysql db
right after upload, without storing a copy on the server and
then referencing the file.
Have another script that gets the image from the db and displays it once
again without storing copies on the server.

to upload its just

<form enctype="multipart/form-data" action="uphome.php" method = "post">
<input type="hidden" name ="MAX_FILE_SIZE" value="500000">
Upload this file: <input name ="userfile" type="file">
<input type="submit" value="upload">

then to reference the file.. should it be?
$fp=$_FILES['userfile']['tmp_name']

I'm not quite sure how to display it, without using copy or
move_uploaded_file first.
Just echoing the regular html <img scr=$fp > doesn't seem to work with the
temporary path from tmp_name? unless I copy the file to some location
which I don't want to do.

I'm also not sure exactly how would I store and retreive the file from
the db.
is it just (after connecting to db) similar to
mysql_query('insert into table (column) values (''.$fp.'')'



Php,images,mysql
I want to give users the power to add images to a database for future display onto a dynamic site. I have the following form:

<form action="formtest" method="post" name="form1">
<input type="image" name="clogo">
<input type="submit" name="submit">
</form>

I have a field in my db called 'clogo' and it is set to 'longblob'. Everytime that I submit the image, the string '[blob]' is being inserted into the table. I need the filename to be inserted so I can eventually display it.

Mysql Images
I stored images in mysql datebase, in the datebase the stored image filed have LONGBLOB type. Administrator can upload images via php script, and visitors must view the images.
the code of viewer is (this is a part of it)

<img src="MyMomainName?viewpic?id=anyInt">

when I'm visiting site all ok , i see all images, and not only me others too, but many users from USA can't see all images. They see some of images and some of them don't displayed, like there is no that image(s).

Before I stored the images in mysql datebase that images was stored in hdd (i mean as files imagename.jpg, or imagename.gif) and visitors see all images there were no any problems.

What happenes when visitor visite now to my site can't see some images?

Output An Image Directly At A Particular Position In The Browser Window
Is it possible to dynamically create an image (jpeg/gif/png) and output
it directly at a particular coordinate position in the in browser
window using PHP GD functions and HTML (if necessary)?

PHP, MySQL And Displaying JPG Images
I got a script that is supposed to display a JPG image from the database, but, instead of displaying the image, it displays the JPG binary output with those alphanumeric characters.

Coule this be a Header MIMI type problem in my script?

I Don’t Want To Put Images In MySql
My site has suppliers and customers. The suppliers are able to have a logo on the site, and are able to upload this logo as needed. I need to have my suppliers upload these small images as needed, and be sure no other person can get at the images.

I want to keep the logo in a file, but it seams to be more of a security problem than placing it in MySql. I understand the argument for having the image in a file and only storing the path in the database. But, the ease of database storage and the security issues seam to offset these advantages.

Uploading Images To MySQL
I'm having a problem inserting photos into my MySQL database. I have the following form to submit the photos: Code:

Store Images Into Mysql?
i'm wondering is it possible to store image (jpg) into mysql? (not talking about url of image, just image)

Images In MySQL Database.
I really do not want to put images in my database, but I want to be able to have a script where users can upload an image, and it will be stored in a database (the file name, name of owner, and the trick performed). Then it will be placed in a gallery.

Writing Images To MySQL 4.x
I have been trying to write an image to a database table BLOB field in
MySQL but when I try to retrieve the image to display it, it shows as
being empty. Are there any special considerations I need to take into
account when reading and writing images to a DB?

Store Images In MySql?
I am working on a CMS for small web site, I am using 2 images in the product template (banner / thumb nail). Can i store image in a database? or Should i just mention the 'path"?

Regex For Images In MYSQL
I have a script that allows uploads and I have this as a regex ^([%w-]+.(?:jpe?g¦JPE?G¦gif¦GIF¦png¦PNG)¦)$ it works fine if the image is named 1234.jpg but I am finding most people are uploading images that are like 12 35.jpg and the gap is causing them to get a error, any ideas on a regex for people that have caps or special characters in the file name?

Uploading Images, Store It In MySql
Im a beginner in PHP and need help in:
- uploading images, store it in MySql, and how to display it on the page.
- categorized the products (ie. guitar, drums, etc.)

Basically, I have a table named "cms_products" with fields prd_title,
prd_description, prd_img, prd_id, prd_price, prd_stock, prd_category

Im not sure if Im going to make another table for the category and image.
Your help is very much appreciated.....

Store/display Images To/from Mysql Using Jsp?
I was looking for a solution on how to store images and display them from Mysql database using jsp or servlet.


Copyright © 2005-08 www.BigResource.com, All rights reserved