I'm trying to use the blueimp Jquery File Upload plugin for the project I'm currently working on. It suits my needs perfectly, with one problem: I need to be able to change the path of the uploads, based on a GET variable on the page that contains the plugin. Basically, I'm using it as an image manager for a collection of vehicles, and I want it to connect to a separate folder for each vehicle.
I've been looking through the documentation and googling, and I've found the way to change the default directory (by modifying upload.class.php) but since I need this to be dynamic, that doesn't work.
I figure there has to be a way to add a POST variable to the ajax calls which activate the php scripts, but I can't even find out where those ajax calls are. I can't even find a reference to either of the php files (index.php and upload.class.php) throughout the code.
Any ideas on how to accomplish this?
In your form, add a field like this:
<input type="hidden" name="path" value="<?echo $_GET['path'];?>">
And in your PHP where the file is uploading, just extract the path with:
$path = $_POST['path'];
Just put the path where it is specified in the PHP script.
Related
Currently I have a project with laravel 5.5
I have some text files stored in storage/public/*
I have been thinking if there is a way to use laravel's blade and open the selected file directly instead of making a request to the backend to retrieve the content then display.
The idea is inside *.blade.php there will be a button to click, then instead of making request to the backend, can we just open the text file then show the content?
let's say for example, I do have html code like
<input type='hidden' value='filePath' name=path>
text file name
when the anchor is clicked, usually it would be making a request to the backend open the file, get the content, pass it back to the front.
But what I am thinking is, since the frontend knows where the path is, name of the file. Is it possible to do it at front end? This way no requests need to be done faster too.
But I do not have an idea how to even start it.
Does someone has any suggestions?
Thanks in advance for any help.
Assuming your files are accessible to the person viewing the web page, you can use file URLS (or just type in the URL in the blade file?).
Title
Or, if the files are pre-determined when the blade file is generated then do something like this in your controller:
use Illuminate\Support\Facades\Storage;
public function index()
{
return view('view.name', [
'url' => Storage::url('file.jpg')
]);
}
And in your Blade file:
Title
If you consider the blade file the front-end, then remember it's not hosted on the server once the user is viewing it. You'll need to do something like the above to allow blade to generate the right file URLs (unless you're just talking about static, hosted files)
But, if your reference to back-end and front-end is about where should the logic go, then the answer is "the back end". The point of the MVC pattern is to put the right bits of logic in the right places, so the Blade file (representing V for View in MVC) should only be concerned with presentation, not digging up files and generating URLs.
I'm new to web development but i know some php basic stuff. Using ftp, i create directories then create simple php scripts there, simple as echoing a string. Which can be accessed like,
www.sampledomain.com/folder1/subfolder2/hello.php
After some time, my friend introduced me to wordpress which is what they described as CMS. I tried to visit her site www.majaflores.com then i click on some stuff there and i noticed the url changed to http://majaflores.com/project/if-i-let-you-in-please-dont-break-anything/
At first, its pretty normal for me because its just a link where there is a folder named "project" and inside it another folder named "if-i-let-you-in-please-dont-break-anything". But when she showed me the ftp folders directory, i didnt see any folder named "project" under main folder of the domain. How did wordpress manage to do this? and how can i implement this manually?
Just wanted to say that like most server-side code environments, PHP also let you parse URLs "manually" and decide what to do accordingly, be it return a file or generate some content.
You can find more information about how PHP is parsing URLs in here:
http://php.net/manual/en/function.parse-url.php
and some discussion regarding it in here:
URL handling – PHP vs Apache Rewrite
This is they way WordPress stores data. U can further see the setting under Permalink.
Under Permalink, u can have options to render ulr as page id, category names and more. You can also use your own format over there.
Just a note, WordPress stored data in database not as a content on FTP directory.
I'm developing a site using joomla template. I want to create a registration form & I design it with html in a Joomla Article. For data passing to db I have created a PHP file. But I have a problem in submitting data. I gave form action="php file name" & I save the PHP file in index path. But system is not working. Please tell me where I need to save that PHP file & how to link my joomla article & PHP file ???
Create a custom file upload component and upload your php files. Create a menu item for your component and assign a PHP file to menu you want to show your registration form on and finally at front-end include PHP file in your view.
Create a folder inside plugins in main directory.
Name it whatever you like, lets say, "customplugin". Put your form handling file in that.
Give the absolute path of this file in the form action URL.
This should work. Also, kindly check if the form tags are coming correctly in the article.
As others are saying, you are actually not using the Joomla CMS properly, but anything and everything is possible...
Mistakes are always forgivable, if one has the courage to admit them.
-- Bruce Lee
I have added an swf in my php page using embed and object of HTML.It loads the SWF in http://localhost/swf.php?action=edit and working fine, but when i apply url rewriting then the swf is not shown on the page although $_REQUEST['action'] prints edit .The URL i am using is http://localhost/swf/edit
Any idea ??
The SWF file is not being shown because, according to your example embed, the site will be looking for the SWF file at /swf/edit/flash/test.swf.
I had the same problem with one of my systems when i first started using the single point of entry ideas.
I fixed our problem by using the tag in the HTML and then making sure that all of the paths built themselves relative to this.
A quick fix to see if this is correct is to change the path of the SWF embed to ../../flash/test.swf - if it loads then you know that its the URL rewrite on the path thats the issue :)
I recently purchased a script that I'm trying to change the CSS to pimp it up :)
However since I'm fairly new to CSS/PHP (I've done ASP before), I'm trying to use the "Live view" feature Dreamweaver 5.5 to edit the tpl.php files. I have setup the site as instructed in DW and it's working with basic PHP files, however when I try to open a tpl.php file it doesnt seem to handle all the includes or something, so essentially it doesnt know how to retrieve all the related CSS etc in order to show me what the site looks like.
It has the following code structure:
www.xyz.com -> this calls the index.php
Within index.php, it calls include_once ('global_mainpage.php');
Within global_mainpage.php it then calls $template_output .= $template->process('mainpage.tpl.php');
mainpage.tpl.php is the file that I need to change the layouts/CSS class reference etc.
My ideal way to work with the site is:
Say if I want to change something on index.php
I just click on one of the elements in live view
It would automatically launch the tpl.php file being used
I can then examine the CSS used and make a change to it
hit save and be able to view the change I just made
If this is not possible, do I have no choice but to use Aptana? I've used it before editing PHP code, but not tpl.php - I was hoping to have a WYSIWYG editor for tpl.php...
Many thanks for your help gurus! :)
Why don't you use FireBug on Firefox and hook it up with cssUpdater?