473,231 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

FILE structure

I've created a function with takes some files (input type="file") as
parameter.

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.

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.

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.

How to fill such $file structure with the different .jpgs ?

Thanks

Bob
Jul 17 '05 #1
4 1873
*** 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
--
Jul 17 '05 #2
> Are you aware that filling the array won't automagically upload files?
I know, the files are actually on my server, like they were uploaded.
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.

This is done in my function, and the process is quite long for what I do,
that's why I want it to be done by my function and create the structure.

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

I'm looking for such associative array struct called $_FILES ! I repeat the
files are already in a directory of my server, accessible by FTP.
I want to use my function to move the files like they were uploaded by a
FORM.

I can't get this struct.

Bob
Jul 17 '05 #3
Bob Bedford wrote:
<...SNIP...>
I'm looking for such associative array struct called $_FILES ! I repeat the files are already in a directory of my server, accessible by FTP.
I want to use my function to move the files like they were uploaded by a FORM.


Why not just use copy()?

--
Oli

Jul 17 '05 #4
*** Bob Bedford wrote/escribió (Mon, 23 May 2005 13:27:55 +0200):
Are you aware that filling the array won't automagically upload files?

I know, the files are actually on my server, like they were uploaded.


Then:

rename Renames a file or directory available since: PHP 3, PHP 4 , PHP 5

usage:

bool rename ( string oldname, string newname [, resource context] )
Don't get confused by the name, this function allows you to move files.

--
-- Á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
--
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Vasilis Serghi | last post by:
Hi all, I am fairly new to C programming and I have come to a stand still. I am trying to create a program that will accept a user input and give the user an output depending on the contents of a...
5
by: Chathu | last post by:
Hello everyone........... I have a problem on retriving a content of a binary file I wrote into. My program user structures, dynamic allocation of memory and files. I take the infomation into a...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
3
by: Zahid | last post by:
Hi, I have declared an array holding a custom declared structure. The structure looks like this: Private Structure MnuDataFrmFile Public menuGroup As String Public ItemDesc As String Public...
5
by: Phil Kelly | last post by:
Hi I need to write the contents of a structure to a binary file - there is one string and 2 integers, but I can't seem to figure out how to write the data correctly. If I am simply writing...
8
by: a | last post by:
I have a struct to write to a file struct _structA{ long x; int y; float z; } struct _structA A; //file open write(fd,A,sizeof(_structA)); //file close
9
by: JimmyKoolPantz | last post by:
IDE: Visual Studio 2005 Language: VB.NET Fox Pro Driver Version: 9.0.0.3504 Problem: I currently have a problem altering a DBF file. I do not get any syntax errors when running the program. ...
19
by: Lee Crabtree | last post by:
Is there a class in the framework that allows me read text from a file in an unbuffered manner? That is, I'd like to be able to read lines in the same manner as StreamReader.ReadLine(), but I also...
4
by: MikeJ | last post by:
make a While loop ofs = TextFileServer("somefile") string srow while (ofs=false) { srow=ofs.getRow(); Console.Writeline(srow); }
6
by: efrenba | last post by:
Hi, I came from delphi world and now I'm doing my first steps in C++. I'm using C++builder because its ide is like delphi although I'm trying to avoid the vcl. I need to insert new features...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.