|
Posted by Alvaro G Vicario on 05/23/05 12:48
*** Bob Bedford wrote/escribió (Mon, 23 May 2005 11:37:34 +0200):
> Now, since this is an array of a structure, I'd like to fill this structure
> with my own datas, as I'd like to use the same function but not from a form,
> but from a self created PHP script.
Are you aware that filling the array won't automagically upload files?
> my function has the file parameter;
> myfunction($files)
>
> I've seen there is a $file['file1']['tmp_name'] field. But how to save the
> datas.
$file is not a standard PHP variable. If it's there, it's because your
script creates it. You can modify it the same way you create it...
> In my case, the files are actually on my server (a program upload files on a
> directory of the server). I must use those files (actually images) to save
> them somewhere else on the site, after renaming and putting some records in
> the mysql database.
You can use move_uploaded_file() giving the tmp_name value as parameter.
> How to fill such $file structure with the different .jpgs ?
As I told you, that's a custom variable *you* create. When you upload files
what you get is an associative array called $_FILES. It's created
automatically when the browser uploads files. As I told you, giving it a
custom value won't upload the file. Check this chapter:
http://es2.php.net/manual/en/features.file-upload.php
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Navigation:
[Reply to this message]
|