I have constructed a site for users to upload their own work and share it.
At the moment, people can search the database for pieces of work and they can upload their own which is working fine.
However, when someone uploads a piece of work I have to manually duplicate a php page, add the url into the database and edit the query to show the relevant content.
I was wondering if there was any way of getting my php file to do this for each upload.
Thanks, Tyler
Related
So I was thinking and thinking and couldn't figure it out. So I was following this tutorial which I want to implement on my site https://www.w3schools.com/php/php_file_upload.asp and on the tutorial when the user uploads their image it sends it straight to a folder, which will obviously be in the server files. Now my problem here is, if I want to display their image somewhere on their profile when they upload it, how would I go about grabbing the image from the folder, or do I have to change the code on the tutorial so that it saves in my database? I really have no clue, and I am now officially lost and anxiety is slowly falling down my imaginary tears that are illustrated by my depressed brain, and yeah.
You save the images in a specific folder, then save the filename in the database. Whenever you want to retrieve this file in your front-end you just take the filename from the database and link to wherever you put the file.
I have to make an facebook app where I have an upload form with two inputs of type file. First input of type file is for uploading an image through PHP. After this comes my big problem.
I have the second input from where I should be able to choose a photo from facebook to upload.
I googled a lot, and found no answer to my question.
Now, I now that after I get user permissions like this:
$userinfo = $facebook->api('/me?fields=id,name,email,last_name,first_name,albums,picture,photos');
I can have the images URL's of the user that gave permissions to enter the app.
What I don't know and didn't found anywhere is how to choose and upload what photo I want into my database, from my profile, through PHP.
Is this even possible?!
How can I at least simulate the normal upload like when using normal PHP way?!
I don't want anyone to do my job for me, I just need a start point.
I have been trying to upload multiple images in Laravel 4, using jQuery & Ajax without the page refreshing, with the progress bar, remove button and review (display the uploaded thumbnail where remove deletes it from the DB).
I have taken many approaches, (http://packalyst.com/packages/package/sukohi/surpass) (despite following every step, still doesn't work). Another approach I used (https://gist.github.com/filip-adriginal/bd397c5ec22a5916a966#file-gistfile1-txt) and tried the jQuery-File-Upload.
I am able to upload multiple images using (using foreach in the Controller):
{{ Form::file('image[]', array('multiple'=>true)) }}
I have also looked at videos, tutorials and blogs, but they either had partial information or unsolved problems.
If anyone could give me some sample code, or point me in the right direction, that would be great! Thanks everyone for any help, really appreciate it.
try DropzoneJs. I think it is the best upload JS plugin
Howto : AJAX multiple file upload in Laravel is a great tutorial using Dropzone.js, check it. Also take a look at this tutorial Laravel Ajax Multiple Image Upload and Preview which uses Dropzone.js as well.
I'm trying to create a photo upload system following Adam Khourys online tutorials.
http://www.developphp.com/view.php?tid=1395 - Upload multiple files video
http://www.developphp.com/view.php?tid=1304 - User profile upload
Most of the code is like for like, but with my own variable names used instead. One major difference is instead of creating 3 different file upload fields as in the multiple upload video I created my form to allow multiple selections from just one upload field.
Below is a brief overview of the files, their location and what the page does.
create_post.php located in root directory - the page that allows for image upload
image_uploader.php located in root > includes directory - the page that contains the upload form, made as a seperate file to be included into any page that may require photo uploads.
photo_system.php located in root > parsers directory - the page that handles image upload.
When I go to the create a post page, click the link to upload image(s) all works well, I can see the form, I can even select the files I would like to try and upload but when I click the upload button nothing seems to happen, when photo_system.php should load.
I've added a line of code to photo_system.php right at the top that should bring up an alert box once the page has loaded, in an attempt to debug my issues, but I never see this unless I go directly to image_uploader.php
This has lead me to believe that maybe my relative links to files were the issue so I've tried appending $_SERVER['DOCUMENT_ROOT'] to the start of the links to ensure it can alway locate them from the root directory, currently I have it set up with a hard coded $root variable and still I can't seem to get the system to work.
Is it likey that the file structure and the way the pages interact with each other is my problem? Could anyone take a look at my code for these three files and see if they can spot anything? I've been stumped by this for a week or so now so I think its time to ask for some outside help.
I have my 3 files saved in a txt format so the code can be viewed
http://www.vwrx-project.co.uk/temp_source_code/create_post.txt
http://www.vwrx-project.co.uk/temp_source_code/image_uploader.txt
http://www.vwrx-project.co.uk/temp_source_code/photo_system.txt
It turns out that in the end I was trying to nest two tables one inside the other so this was part of my issue.
The way that I had it set up I was including the photo upload system, image_uploader.php, as a table with an action requesting the photo_system.php file which worked when I went to the image_uploader.php page directly.
I also had in my main page where the images were being uploaded a form that had been set to onsubmit = false and this was canceling out the form action of the included file.
I only found this out when I decided to try and code it straight into one file else I'd still be stuck now.
I'm trying to figure out the logistics for a new site that I'm creating, and one of the main issues is to get verification working correctly. One of the verification methods i'd like to incorporate is for a specific image (created via gdlib on the fly) to only work on a web page that is specified in a database field. If the image is shown on the EXACT page that is specified, then it shows the correct image, and if the link is incorrect, then it shows a different image (set by admin). The fields will be created on the admin side, and I'm trying to figure out how to get multiple instances of this working correctly. I'm using PHP and using a tag like [img src="something_here.php"] to show my images. Any suggestions on how to set the coding to verify the site that the image is embedded into?
Update So I got it working, but the request_URI command only works for the extension "ex. login.php", as opposed to adding in the absolute domain also. Any suggestions on how to make it factor in the whole domain address?
If you create an image with gd, you can put any PHP code on the page. for example: if ($_SERVER['REQUEST_URI'] == '/specialWebPage.php') { ... }.