Forum Moderators: coopster
Do I have to escape some of the characters or is it a case of actually writing the file to the database. I have looked for some scripts to give me some hints and one has the following:
$data = addslashes(fread(fopen($form_data, "rb"), filesize($form_data)))
Not sure what the "b" is for in the file mode?
Not sure what the "b" is for in the file mode?
binary - useful only on systems which differentiate between binary and text files such as Windows
fopen [php.net]
but it is just showing text ie. the path to the file instead of the actual file
$_FILES just contains infos about the uploaded file. $_FILES['userfile']['tmp_name'] will give you the name of the temporary file on the server. To store the file to the database you have to open it and read it as suggested by the little code snippet you included in your post.
You can just hard code the path into the script. Have a designated dir for the uploaded images or something.
>>user access to the directories
The scipt would have the access, not the user.