Jump to content
Server Maintenance This Week. ×

Uploading an image


This topic is 7255 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am in need for some hints on how to upload an image from my lokal disk, to a container field in my database.

Have tried something like this:

---------------

<?php

if(is_uploaded_file($_FILES['form_image']['tmp_name']))

{

// file uploaded to server

echo "file information is :-<br />";

print_r($_FILES);

$imageInfo = getimagesize($_FILES['form_image']['tmp_name']);

$width = $imageInfo[0];

$height = $imageInfo[1];

$image_type = $imageInfo[2];

print_r($imageInfo );

// move_uploaded_file($_FILES['form_image']['tmp_name'], "./test/".$_FILES['form_image']['name']);

}

else

{

echo "file not uploaded to server";

}

?>

<html>

<body>

<form name="file_upload" method="post" action="process.php" enctype="multipart/form-data">

<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />

<input type="file" name="form_image" />

<input type="submit" value="Send this file!">

</form>

</body>

</html>

----------------

Would it be possible to use the $_FILES['form_image']['tmp_name'] in an FMEdit()? Or are there some other obstacles on my way?

Link to comment
Share on other sites

Hi Max!

I see you found the forum that suits your question better!

Garry...I am currios to know why not use an alternative!

Theoretically:

-if the images are referenced you can just "Create a New Record" and provide filename and path.

As far as web is concerned u never really have to "insert images" into DB (container) but rather record the paths (text) relative to the server and then display it as usually:

eg.

---main.fp5----------

[img_name] [image_path] [image_URL]=image_path & img_name

abc.jpg /images/

---------------------

The idea would be to have "virual folder" (eg. 'images') pre-set.

from FM prespective:

I posted a small sample on (fm6 ) on importing images as folders that can be used a "admin" part of it all should the user need to use only FM to access the DB...

...again, if this is stricly web use then just the path info is enough

perhaps I spent too much time on other forums but this would be initail idea...hope it helps

Take care!

Link to comment
Share on other sites

I perfer to have just the image filename in the database. You then have full control of building paths/URLs etc. The images can then be anywhere, even on a mounted Firewire drive!

You can also construct paths (or names) to thumbnails, different versions etc.

All the best.

Garry

Link to comment
Share on other sites

This topic is 7255 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.