Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I've created a small website with PHP and MySQL. The website allows a user to fill in a questionnaire (which is saved in a database) and then an admin person needs to view and then upload results in PDF format so the original person can view them. In fact the admin person can upload multiple PDF's (over time not in one sitting) to give more feed back which need to be accessible to the user.
My question is, what would be the best way to do this? First, should I upload files via PHP or would jQuery or the like be better? Should each person get their own directory? (does it matter if there are 100's of users?) How can I read all the files that pertain to a particular person and then allow them to view/download it?
Thanks in advance!
you can use form and php to upload file. If you need validation do it with php (for server side validation) or javascript (for client side validation), i recommend that you do both.
To distingusih between user data, you can use prefix for filename with username or something (ie. user1_file1, user1_file2, user19_file18), since i think it will be messy to create folder for each user.
To give link for user to download just add "location" column to your user database that contain the file path in your server. With this, you can check their username and every file that they upload in your database.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a site with over 15,000 signups presently (both legitimate users, activated users, and unscrupulous entities).
I set up the signup in such a way that for every signup, a folder is created with an index php file to redirect anyone that tries to access the folder.
I got a new shared hosting server recently and i got confused when they restricted file count to about 50,000 15,000 * 2 is 30,000 already and some users have uploaded files and images on the site already.
Is that structure a good one? i mean creating a new folder for each user signups?
The server is a Linux and the scripting language is PHP
Edited I create folders for each users because I want to distinguish each users files as each users can upload files like pictures, pdfs, docs etc.
Do I keep all files whatsoever in just one folder?
If you be storing major information's within a file for each signups (eg: including "password, email, phone, credit card"...etc) will be a bad idea.
MySQL will store them in a better way, also; there a lot of scripts you can use.
If you want to build it your own, I suggest you learn more about PHP of handling user registrations. It does take a lot of time and energy!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
is there a way to upload a file that the user have uploaded before into the database? eg, you have uploaded a resume into your own profile page (online) and now, you would like to send this same resume (online) to another person by uploading to the same website. however, it has to be chosen from your profile page
It is possible, but pointless. As #Mubin Khalid said, you should store these resources as files and store their path in the database. The file can be accessed through its path and you need to load only that from the database. If you want to duplicate files, then you have serious problems with the design of your database.
You need to have a table for resources, like this: resources(id, path). Naturally, based on your business logic, you might need other columns, like resource_type or owner. To handle attachments, you need to tackle with the n:m relation types using intermediate tables, which will have a foreign key which references resources(id).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Is it possible to edit a php file from itself? I would like to have a php file that a user can log into with their e-mail address and password then give them a several fields they can edit. Upon submitting their entries the actual php file they used to submit info is updated.
Lets say there are three fields displayed once logged in...
1. Email (can not be read when rendered in a browser or via source code)
2. Password (can not be read when rendered in a browser or via source code)
3. Textarea (contents you submit in the textarea would be visible if you load page in browser, in addtion, a blank username and password field would be visible in a browser, so the owner could login to edit the file)
With this system the user would be able to edit their login information and change information displayed on the page when viewed through a browser. Using the email in the file I guess I could include a sendmail function should they forget their password.
Is this possible. If so, does anyone know of a simple script that I can use to get started?
You are are better off storing the information you want to change in another PHP file. Then loading/editing it on request.
Editing the file you are using can cause issues. You could also loose all of your code if something is injected that corrupts the formatting code.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm creating a android chat application with a basic layout and hosted in a php hosting service and mysql as my back end. I'm retrieving the user details using JSON from server to update my user lists. Now these are my issues regarding profile pics
But now I wanna store profile image of the user. I really have no idea of storing profile pics. Becoz other people have mentioned that storing image in the mysql table would bring down the performance of the db system. Which is efficient way to do this?
While retrieving image (weather it is in mysql or server), I don't want to load profile pics each time. What can be done for this issue ?
I worked on the same project once
1 - The best way to store profile pictures is to do it like Viber and Whatsapp store them in the internal memory or external if there is any available space of course
2- well you need to cache your photos once loaded the first time and then just load them from the cached version if there is any modification then you apply the new photo in place of the cached one and cache it again
[EDIT]
After your comment I understand that you're using mysql to store chat messages and profile pictures, so you can go this way :
you store the images in the mysql database within your server and for every user you download his friends pictures then cache and store them in the sdcard.
for every new user you ask him to upload his picture to your database then his friends will download it back.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Okay so I am doing this project and i need to allow the user the ability to upload 6 images, how should i go by doing this on the database side of things.
Make a column for each image
Store it in one column as an array and then do the processing of the array with PHP?
I will be useing the Yii Framework and also MySQL as a database engine.
I know how to upload file and store it to a directory and the other needed things, just not sure what to tackle the problem.
EDIT: My final goal is to have this index page edited by one user (Admin) and I want him to allow him to edit the images and the current offers as well.
You should create table user_images beacause:
You can change number of images pef user in the future without changing database
You can easily display all images in GridView and easly generate CRUD for user images.
You can easily store versioned list of images for user.
Implementation and code reusable will be simplier.
You should create a new table called "user_images(id, user_id, image_url)" to store image.