1 Replies - 945 Views - Last Post: 16 February 2014 - 05:49 PM

#1 OS_Omar Saab   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 11-February 14

how to view uploaded files (by user) on my website?

Posted 16 February 2014 - 05:00 AM

Hello everybody ! :)
I have a website in which I am using HTML, CSS, Javascript, PHP and a tiny bit of JQuery.
The thing that I wanna do is that I want files uploaded to my website to be visible to the user on a certain page of my website, or under a "your uploaded files" section.

when the user uploads his files to my website, and after the uploaded files are saved on my "/upload" directory, the files will be automatically added to the list of the uploaded files and visible to the user in a certain place of my website.

NOTE that I do not have any idea how to do this, so I do not have any code that I have tried to write. I know that it is not a place to order codes and receive it. But please can anybody help me in this? Any help will be highly appreciated and thanks in advance :)

Is This A Good Question/Topic? 0
  • +

Replies To: how to view uploaded files (by user) on my website?

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5227
  • View blog
  • Posts: 14,010
  • Joined: 18-April 07

Re: how to view uploaded files (by user) on my website?

Posted 16 February 2014 - 05:49 PM

Well typically this is done using a database which associates a User ID number assigned to the user (when they registered) to be linked to all their uploads. Then on the pages you want to show a user their own downloads, you can query the database for the User ID making the request and have it pull all files linked to that ID.

So for instance, when I signup to your site perhaps I am given a unique user ID of "2". Then I upload three pictures. Each picture would be uploaded to your /upload directory, perhaps renamed to add their user id (but that is optional) and three records are added to a database like...

UserID  |  FileName  |  Uploaded
2  /upload/MyPicture1.jpg  2014-01-21 2:33pm
2  /upload/MyOtherPicture.png  2014-02-01 12:34pm
2  /upload/ThirdPicture.jpg 2014-02-12 9:04am

Then whenever I, the user, request to see what files I have uploaded you would create a query to the database that will show all records with my ID...

select * from uploadedFilesTable where UserID = 2

I could even add an order by clause to the query if I wish to show the files I have uploaded by their uploaded date in descending order.

Hope you get the idea now. All you need to do is make that relation between the user who made the action and the file they uploaded. This is typically done using a database.

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1