GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 12-Mar-2004, 21:52
prinzekay prinzekay is offline
Awaiting Email Confirmation
 
Join Date: Mar 2004
Location: Kuala Lumpur
Posts: 3
prinzekay is on a distinguished road

uploading files into server


hie,

i would like to ask if anyone got any codes that will let the user upload their files or pictures on the server?

secondly, after uploading the files, how am i going to retrive the uploaded file from the server?(ie: if a user upload a picture,then the picture will appear according to the user's id)

i'm asking this because i'm thinking of whether to upload pictures/files into mysql or just the server.Then i found few articles that suggest me to upload it into the server instead of mysql database.got an opinion anyone?

thanx in advance.
  #2  
Old 13-Mar-2004, 08:30
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hello prinzekay,

No we do not have specific code to do that but if you want to discuss the code you ALREADY have, then we can help. This should be easy to do...

... and yes, storing the 'files' on your server is the recommended way to go, just place a link in a db table so you can still easily match USER_ID with UPLOADED_FILE.
  #3  
Old 13-Mar-2004, 08:30
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Quote:
Originally Posted by prinzekay
hie,

i would like to ask if anyone got any codes that will let the user upload their files or pictures on the server?

secondly, after uploading the files, how am i going to retrive the uploaded file from the server?(ie: if a user upload a picture,then the picture will appear according to the user's id)


i'm asking this because i'm thinking of whether to upload pictures/files into mysql or just the server.Then i found few articles that suggest me to upload it into the server instead of mysql database.got an opinion anyone?

thanx in advance.

Hello prinzekay. Welcome to GIDForums.

This is something that I am currently working on as well. There are codes available for this, so far I have found many perl implementations and a few C++ implementations. Here is a link that goes into some detail about how to do this.

I am doing my own C++ implementation currently and it is not terrible to code yourself. If you are going to write the server side yourself, I can give you some hints about what you will get when a person uploads the file.

Hope this helps.
  #4  
Old 14-Mar-2004, 22:53
prinzekay prinzekay is offline
Awaiting Email Confirmation
 
Join Date: Mar 2004
Location: Kuala Lumpur
Posts: 3
prinzekay is on a distinguished road

thanx guys...


thanx guys for the tips!

to JDS,
i don't really understand what u said last time, about putting a link to the database so it matches the the user_id and files_uploaded?can u elaborate more?thanx...

to dsmith,
thanx for the link u gave me, it gives me better understanding of the concept discussed. I'm interested to write the server side code on my own...do u have any tips for me?thanx...
  #5  
Old 15-Mar-2004, 08:49
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Okay. I am about done writing my server side script for it, but I did it all in C. I want to test it out a bit before I am 100% confident that it works, but so far so good.

For testing purposes, I am using this simple http code:
HTML Code:
<html> <body> <form method=post action="/cgi-bin/test" enctype="multipart/form-data"> <!-- It is critical to set the enctype to multipart/form-data --> <P>Submitted by: <INPUT TYPE=TEXT NAME="in_by" SIZE=50> <P>Brief Description: <INPUT TYPE=TEXT NAME="in_brief" SIZE=50> <P>Description: <INPUT TYPE=TEXT NAME="in_password" SIZE=200> <P>File to upload: <input type="file" name="in_file"> <P><input type=submit value="Submit"> </form> </body> </html>

When someone hits the submit button, a file called "test" will be called with the following text piped to it.
Code:
-----------------------------41184676334 Content-Disposition: form-data; name="in_by" Bob Jones -----------------------------41184676334 Content-Disposition: form-data; name="in_brief" test -----------------------------41184676334 Content-Disposition: form-data; name="in_password" This is a test -----------------------------41184676334 Content-Disposition: form-data; name="in_file"; filename="digit.c" Content-Type: application/octet-stream void digitize(int num,int digits[], int size) { int digit, left, pos; //initialize array to all zeros. for(pos=0;pos<size;pos++) digits[pos] = 0; left = num; //don't want to screw up original number pos = size-1; //Start from back is easiest. while((pos) && (left)){ digit = left % 10; left = (int) left/10; digits[pos] = digit; pos--; } } main() { int number; int digits[10]; int index; printf("Integer test\n"); printf("Enter number: "); scanf("%d",&number); digitize(number,digits,10); for(index=0;index<10;index++) printf("Digit #%d is %d\n",index,digits[index]); } -----------------------------41184676334--

As you can see it seperates all of the fields by
Code:
-----------------------------41184676334

The alpha-numeric part of this is random in both length and content, but it will be the same for the entire file. The end seperator adds on "--" so that you know when you are at the end of your file.

If you do know C, I can definitely give you my parsing routines so that you can look at them. (in that case, we should also move this thread to the C Forum.)

Hope this helps,
d
  #6  
Old 16-Mar-2004, 01:00
prinzekay prinzekay is offline
Awaiting Email Confirmation
 
Join Date: Mar 2004
Location: Kuala Lumpur
Posts: 3
prinzekay is on a distinguished road

thanx...


thanx dsmith...i understand the codes, n i'll try to run it on my pc later on...as i've found the codes in php to upload the files into server.maybe u guys can comment on the coding of this program.because i'm planning to use these codes.it's a bit poor on the gui though,but it get the job done.thanx...

www.korn.lp-hc.us
 
 

Recent GIDBlogProblems with the Navy (Chiefs) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to allow download file in Apache Web server? Zaro Apache Web Server Forum 1 24-Feb-2004 03:41
how to use our PC as a webmail server? razahasnain Web Hosting Forum 3 17-Jan-2004 19:24
· Windows 2003 Server Reseller Special: Unlimited Domains/2 GB Space/for $19.99 contactsonia Web Hosting Advertisements & Offers 0 09-Jan-2004 06:46
Help making Apache to WAP server ! Lazmo Apache Web Server Forum 1 02-Jan-2004 13:27
gxx linker accepts only 7 object files danielxs66 C++ Forum 1 12-Dec-2003 10:27

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 05:24.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.