Hi
Can anyone explain in layman's terms the sequence of events required to
upload a csv.txt and put the contents into an array.
Lets assume I have a form to select the csv.txt file, which then uploads,
then what happens to it? where does it go? how do I get it out of the ether?
How, where do I access it. Looking at the PHP manual, I deduce that I need
to some how use the fopen and fgetcsv but unfortunately it reads like
gobbledygook to me at the moment.
I can do, see and understand that if it was a picture, it goes into a
directory on the server and resides there, but I don't want the csv.txt file
to be saved.
--
Regards
Stephen 3 3541
Stephen Preston wrote: Hi
Can anyone explain in layman's terms the sequence of events required to upload a csv.txt and put the contents into an array.
Hi, Lets assume I have a form to select the csv.txt file, which then uploads, then what happens to it? where does it go? how do I get it out of the ether?
It goes a a temp directory under a temp name.
You can easily retrieve it and store it in a place you want it to be.
This is done by the code in the receiving script (= the script mentioned in
the action-tag of the form that contains the file-selector for the
fileupload.)
Read more here: http://nl2.php.net/manual/en/features.file-upload.php
How, where do I access it. Looking at the PHP manual, I deduce that I need to some how use the fopen and fgetcsv but unfortunately it reads like gobbledygook to me at the moment.
First get the upload up and running, then start with the handling of the
file.
fgetcvs() is a nice helperfunction, but you can do it by hand too.
Really, just try it.
No use in us telling you what to do to the letter if you don't understand it
yourself.
If you want to test your result somehow (the array), a handy function is
print_r(). It prints the, possibly complex, structure of the array.
Use pre, like this:
<pre>
<? print_r($yourResultArray); ?>
</pre> I can do, see and understand that if it was a picture, it goes into a directory on the server and resides there, but I don't want the csv.txt file to be saved.
Then delete it afterwards.
unlink()
Regards,
Erwin Moller
On Thu, 09 Mar 2006 10:07:07 +0100, Erwin Moller wrote: First get the upload up and running, then start with the handling of the file. fgetcvs() is a nice helperfunction, but you can do it by hand too. Really, just try it.
But if you try to handle it yourself don't fall in to the pitfall of just
exploding the string on "," as some CSV files may have commas within
columns, e.g.:
Name,Age
John Smith,21
"Doe, Jane", 21
Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer http://www.gphpedit.org | PHP editor for Gnome 2 http://www.andyjeffries.co.uk | Personal site and photos
Thanks
The light has now come on :-)
"Stephen Preston" <st*************@btconnect.com> wrote in message
news:du**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com... Hi
Can anyone explain in layman's terms the sequence of events required to upload a csv.txt and put the contents into an array.
Lets assume I have a form to select the csv.txt file, which then uploads, then what happens to it? where does it go? how do I get it out of the ether? How, where do I access it. Looking at the PHP manual, I deduce that I need to some how use the fopen and fgetcsv but unfortunately it reads like gobbledygook to me at the moment.
I can do, see and understand that if it was a picture, it goes into a directory on the server and resides there, but I don't want the csv.txt file to be saved.
-- Regards
Stephen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jens Mittag |
last post by:
Hi!
In my code, I have an array of a structure, which I want to save to a
binary file. When the array is just created, everything works fine, but
when I change contents of the array, saving...
|
by: Betty Hickman |
last post by:
I'm having trouble writing a 2D array to a binary file. Here's what I
have:
FILE *outfile;
short **clump_class;
clump_class = malloc(nrows * sizeof(short *));
for (i=0; i<nrows; ++i)...
|
by: steph_de_marseille |
last post by:
I would like to write a x array in a file.
If the array has a small numbers of columns I know I can use a loop
like:
int i,j;
double array;
FILE *file1;
file1=fopen("data.dat","w");...
|
by: melanieab |
last post by:
Hi,
I'm trying to store all of my data into one file (there're about 140 things
to keep track of). I have no problem reading a specific string from the
array file, but I wasn't sure how to...
|
by: kelly |
last post by:
Hi,
I don't have a code to show you, what I need are references or
algorithms so that I'm in a right track.
By the way, thanks for introducing me the array or arrays. Now I can
continue my...
| |
by: yourmycaffiene |
last post by:
Okay, this if my first post so go easy on me plus I've only been using
C for a couple of weeks. I'm working on a program currently that
requires me to read data from a .dat file into a 2d array and...
|
by: Adi |
last post by:
Hello eveyone,
I wanna ask a very simple question here (as it was quite disturbing
me for a long time.)
My problem is to read a file line by line. I've tried following
implementations but still...
|
by: theballz |
last post by:
Hi,
I am learning c programming and come across a problem i cant seem to
solve. I have a file which i wish to parse and put certain lines
(which do not contain a hash character) into an array...
|
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...
|
by: rohit |
last post by:
Hi All,
I am new to C language.I want to read integers from a text file and
want to do some operation in the main program.To be more specific I
need to multiply each of these integers with another...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |