ChronoFish wrote:
[color=blue]
> "Alper Adatoz" <allper@myway.com> wrote in message news:eae08b72.0311110522.62b12fd3@posting.google.c om...
>[color=green]
>>Hi,
>>
>>i have a little problem. i hope u guys give me a clear solution (:
>>
>>db: mssql
>>
>>i just want to put jpeg file to the image field at the mssql db.
>>
>>and after that i want to call it back..
>>
>>how can i do this ?[/color]
>
>
>
> You can do this in PHP/MySQL, but you should develop this in an iterative stepwise fashion so that you understand what is happening.
> Your code below has two issues. The first is uploading and saving a file. The second is saving binary date to a MySQL database.
>
>
>[color=green]
>>i tried this code ;
>> $image = $_FILES['form_data']['name'];
>> $image_yol = $_FILES['form_data']['tmp_name'];
>> $newdata = "$image_yol";
>> $data = addslashes(fread(fopen($image_yol, "r"),
>>filesize($image_yol)));
>>[/color]
>
>
> With out getting too deep here, your first goal is to be able to upload and save a file - any file - graphic or otherwise. Here's a
> hint. You are not going to be "addslashes" to the raw data - only to the data coming from the HTML form.
>
> The PHP documentation is excellent and you will probably find some code you can copy and past from here:
>
http://www.php.net/manual/en/functio...oaded-file.php
>
>
>
>[color=green]
>>to put image to the db...
>>but it gave me an error like[/color]
>
> ...
>[color=green]
>>do you have any idea?
>>[/color]
>
>
>
> The next step is saving data to the database. I assume you can save and retrieve text data from the database already. If not,
> start there. Once you do that read up on "Blob" data types. The MySQL documentation is not laid out as well as PHP.net (in fact
> PHP.net should be the model for document presentation... I digress...) but have fun searching for the information here:
>
http://www.mysql.com/documentation/m...ter/index.html
>
>
> Now you can combine what you've learned and you will have your answer.
>
> But as pointed out in another one of your responses, you may be better off saving the graphic to an "images" directory and then
> simply saving the URL to the image in your database.
>
> This would be easier on the database and will be easier to retrieve (you won't have to worry about sending HTTP header info when you
> want to display the image from the database), but your requirements may not allow you to be this flexible (i.e. copywrite issues
> won't allow a static URL to an image).
>
> Hope this helps,
>
> CF
>
>[/color]
i am using php and mysql on my localhost