Re: PHP-DB] Re: No data?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim I believe your correct.

Upload the file to temp
move the file to your dir on your server
and rename file
you can also set the permissions of the file while moving it.
put url to file (not temp file) in database (not the file contents)
done

Best,
Karl

On Jul 26, 2012, at 4:50 PM, Brad wrote:

I apologize, I may have been mistaken about the role of $_FILES but this -> http://dev.mysql.com/doc/refman/5.0/en/load-data.html confuses me. The use of $_FILES with LOAD DATA is littered over the internet and manuals as a 1
shot deal. No hand off to another directory for storage till the next
function gets to it.
Straight from remote drive to database in 1 single quick shot.

Yours may be a work around but I honestly want it to work correctly. I'll
delete the server prior to a left field hack to accommodate a failing
function.  :(



-----Original Message-----
From: Jim Giner [mailto:jim.giner@xxxxxxxxxxxxxxxxxx]
Sent: Thursday, July 26, 2012 5:17 PM
To: Brad
Subject: Re:  Re: No data?

you need to read up on how html uploads files and how php handles them.

You cannot just use the temp file (I may be wrong here, but in general one doesn't use it.). You need to use the $_FILES info in order to get the uploaded "temporary" file and save it permanently somewhere on your server. THEN you can use it and when through with it, you can choose to delete it. That's how it works. The code that I gave you days ago accomplishes exactly
that and it gets used regularly on my site, so I know that it works.

Please try it and then use an ftp client to connect to your server and see that the newly uploaded file is there. Then you can do what you wish with
it.
On 7/26/2012 5:10 PM, Brad wrote:
I don't 'have' a file. It creates a temporary file and then deletes it
just as fast in /tmp/.
Plus, how would I $_GET it? $_FILES is supposed to handle 'ALL' of
this for me? If not, what the heck does it do?


Brad Sumrall
NYCTelecomm.com
212 444-2996


-----Original Message-----
From: Jim Giner [mailto:jim.giner@xxxxxxxxxxxxxxxxxx]
Sent: Thursday, July 26, 2012 5:02 PM
To: Brad
Cc: php-db@xxxxxxxxxxxxx
Subject: Re:  Re: No data?

Not sure what you mean - "Program reads array". What program is doing is utilizing the FILES element to get the info about the uploaded file
and proceeds to finish the upload by moving it to a temporary folder
of your creation.  Once that is done you HAVE the file under whatever
name you want to call it in whatever folder you want it in.

Why don't you just do that part and then use some tool to look at your
server structure to verify that you have the file.

NOW you can proceed with the rest, if you must.  You're going to
create a table with a column/field name matching the filename and then you'll put the contents of that file into that single column in one record
of this table.
So now you have a one record table with one column holding the
contents of a file.  How is this different from just having the file?

1 User uploads file
2 program reads array
3 program creates a table called $memberID.$filename  if not exist
($filename is column)
4 program uploads data into table/column

I am messed up at #2 for some reason so #4 fails.






--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux