Can't upload file from flash direct to mysql database

Hi all,

im quite competent with programming and such but i have a problem that is becoming increasingly frustrating for me…BIG TIME!!

  1. actionscript 2.0, php 4.? and mysql 5.0??
  2. Using at the moment (for testing) localhost apache 2.0, and the above (1) applications.

THE PROBLEM!

I can upload a file from flash (with fileReference class) to the fileserver (to a created ‘/images’ folder). However, I want to upload to the blob type of a mysql server database rather than the fileserver storage way of doing things, but when i try to upload to a blob type i cant upload!!! ive tried numerous ways with no luck. I cant find a tutorial that takes a file uploaded from a flash end user application and store it in a mysql database!! only storing it in a folder instead. I require it to store in the mysql database however but i just cant seem to make this happen.

could please someone direct these thread to correct place if it isnt… could someone please direct me to an appropriate tutorial or could they just explain how my problem could be solved. PLEASE!!! im at wits end!!!

to clarify: im using fileReference to upload from flash, to php (MOVE_FILE - helps to send it to a folder on the server) i want to post the fileReference directly to the mysql instead or alternatively,

  1. take the file that is uploaded to the folder, read it with PHP, store it in mysql then delete from folder, although this could cause slower processing times for the end user as more computations are required!

The flash application is ultimately a photo album where the user can upload to the database and then retrieve those images later…so if i going to have trouble retrieving images from the blob please do also give me a heads up now!

thank you very much, sorry for the long post!

I would just like to interject that storing images directly in a MySQLd is almost always a horrible idea.

Storing images in a the database increases the filesize of your MySQLd operations dramatically. Reading an image from a folder is just a simple file operation, instead of massive update/insert/delete in database. It just puts an unnecessary load/strain on your MySQLd (which tbh, probably is among the most performance-critical parts of your site)

I just published an article on mySQL performance, might be a good read :wink:
http://www.erikhallander.com/blog/2008/web-server-performance-guide-part-23-mysql.html

I personally never use blob types. Can you tell me an instance where they would be advantageous?