Skip to main content
September 23, 2009
Answered

image and mysql

  • September 23, 2009
  • 1 reply
  • 813 views

Dear,

I am looking for some help on how to record information about an uploaded file in a database table. I want to create a upload directory in my site root, and have just the information of the uploaded file into my database (have in tabe, image_x.pnp and so on) the image_x.png represents the file that was uploaded,

thank you all,

romeo

This topic has been closed for replies.
Correct answer David_Powers

romeo umulisa wrote:

I am using dreamweaver built in behavior, but also with additional self writing code when needed.

Dreamweaver's server behaviors don't handle file uploads, and the Insert Record server behavior uses information passed by the $_POST array, whereas the name of your image will be in the $_FILES array.

Although it's possible to edit the Insert Record server behavior code to handle an uploaded file, I think it's probably quicker and easier to hand code it.

// remove any spaces from the file name

$file = str_replace(' ', '_', $_FILES['image']['name']);

// move the file to the upload directory

$success = move_uploaded_file($_FILES['image']['tmp_name'], $uploadDir .'/'. $file);

if ($success) {

  // insert the file name into the database

}

1 reply

Günter_Schenk
Inspiring
September 23, 2009

Is this question related to the former Adobe Dreamweaver Developer Toolbox (ADDT) extension, or are you using Dreamweaver´s built-in server behaviours ?

Cheers,

Günter

September 23, 2009

I am using dreamweaver built in behavior, but also with additional self writing code when needed.

R.

Günter_Schenk
Inspiring
September 23, 2009

that´s why I´ll be moving this thread to the regular Dreamweaver Application Development forum ;-).