|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
fopen, fread, fwrite question
I have 5 files in different directorys. I need to open each of these files and concantonate them into 1 file. the files are comma seperated line by line.
I have a grasp on how to open and read the files, but I am kinda lost on saving the group into 1 file. TIA
__________________
-- Jason |
|
#2
|
|||
|
|||
|
Well, if you are reading the files correctly - you would have each file conetents bound to a scalar. With the scalars, you can write the file as so ->
PHP Code:
__________________
~ Joe Penn We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set? Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you. |
|
#3
|
|||
|
|||
|
ok I see,....thanks jpenn
|
|
#4
|
|||
|
|||
|
is there a way using fread that I can skip over the very first line in each file?
|
|
#5
|
|||
|
|||
|
Well, you can use just file and skip the other filesystem functions. Not nearly as fast as the other filesystem functions, but will do what you need ->
PHP Code:
$data_scalar will hold your data with the first line being removed. |
|
#6
|
|||
|
|||
|
I am having problems opening the files for reading,.....how would I go about conenction via FTP and retrieving the files that way?
|
|
#7
|
|||
|
|||
|
Quote:
Where are the files stored? Are they on your site or another site? |
|
#8
|
|||
|
|||
|
they are on my site,.....they are exports from a shopping cart. I would assume since the files are owned by the same user, that I would be able to open them. I can open them and download them fine via FTP.
|
|
#9
|
|||
|
|||
|
Are you using absolute paths? Example:
PHP Code:
Are you getting any errors? Remove the error supression (@) from your functions so the errors will show... |
|
#10
|
|||
|
|||
|
won't work,...casue the export dir is not in the doc root,...
it would be more like,... cwd = public_html dir = ../secure_dir/exports I think the reason I can't open the public_html dir is not the same owner as the export dir owner. |
|
#11
|
|||
|
|||
|
Quote:
Permissions - is this your server or is it a shared host? |
|
#12
|
|||
|
|||
|
dedicated,....it is ours,....
|
|
#13
|
|||
|
|||
|
Change the dir permissions so php can access the files. Also, waht errors are being returned?
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > fopen, fread, fwrite question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|