I am using Kohana 3. Up to now my downloadable files were residing in my application document root. So far using $this->request->send_file($download_file); it was working perfectly right.
But now my downloadable files are on another server can be accessed using http say http:://www.test.com/download/test1.doc. So Kohana's $this->request->send_file is no more working.
Can anybody tell me what could be alternate solution?
You will probably want to use Remote::get to download the file locally, then use Request::send_file to download the file.
If the server is public, you can simply redirect to the file in question.
$this->response->send_file($file);
worked for me ..
Related
I need to prevent people from downloading .zip files in my server unless they are logged in. For this purpose and since I'm also using MediaWiki and I would like to have to modify the least this as I'm not familiar with it I was thinking about doing the following:
When a user wants to download a .zip file, it will be redirected by the server (with a web.config rule) to something like download.php?file=fileName and inside the PHP, I can do my programming to see if he's logged in and then use readFile() to give him the file.
However I'm not familiar with IIS (not much more with Apache either) and I'm totally clueless as how to write this rule. Could someone please help me out on this?
I'm also open to other suggestions. Putting the upload folder in a place not accessible to the public (but to the server) may do the trick but images are also uploaded then and then they wouldn't download. I could, again modify the behavior of the upload system myself but as it's done by MediaWiki I would prefer not to.
I have found this code (by using a .htaccess to web.config online translator) but it's not working. Maybe it's easier for you to just fix this code:
http://pastebin.com/waMJnFyK
The uploads are in subdirectories within /images like for example /images/a/ae/file.zip and I would like that when you try to open that you get redirected to a php file where as a GET input I have the file location.
Solution I took: http://pastebin.com/7skGT9uN
It redirects everything that ends in .zip within /images to download.php?fileName=whatever where the /images part is not passed.
I have a script that generates a pdf file using DOMPDF. Locally it generates fine the way I want it to be but online, the formatting is scattered. These are the two samples
I am using PHP 5.3.x locally and online. I don't know what the problem is. Please could someone help
I also gone through the same problem. Dompdf is perfectly working on localhost but not on live server. Actually my localhost is having php-version-5 and the server is running on php7.
So here's the solution:
just use dompdf-0.8.6 on server .
This worked for me.
you can download it from here : https://github.com/dompdf/dompdf/archive/v0.8.6.zip
My fix was to use asset to access my css file on live server, for example {{asset('css/style.css')}} and that fixed my issue, while on local server, what worked was using the public_path to access the css file, example {{public_path('css/style.css')}}
I just had the same issue... the problem is using custom fonts.
Don't just try normal #fontface css embedding, use DomPDF's font loader and 'install' the font.
See link for usage for load_font.php : https://github.com/dompdf/dompdf/wiki/UnicodeHowTo#use-the-load_fontphp-script-included-with-dompdf
In my case (v 0.7.0), the problem was that I was missing some required libraries in the "lib" folder, namely:
php-font-lib
php-svg-lib
Both can be downloaded from Github, and then add 2 folders with the above names into the lib folder, where you should dump all the downloaded files.
Or, better yet, just use Composer next time! (this is a note to self)
I've same problem and solved by deleting just a single file. The file which is under 'dompdf/lib/fonts/dompdf_font_family_cache.php'
You may get this answer better
I tried to use Google Doc Embedder by using this code
[gview file="http://localhost/wordpress/wp-content/uploads/2013/07/list.pdf"]
but this error keeps on showing up..
Sorry, we were unable to find the document at the original source. Verify that the document still exists.
You can also try to download the original document by clicking here.
I checked in the directory/path to verify and its still there. So what is the reason that this error keeps on showing up?
Google Docs doesn't have access to your local machine. It will need to be on publicly accessible web server for that to work.
Your file path is wrong. You are pointing to localhost for your server. This is something running on your machine only so google reader would not be able to point to a file on your machine.
You should upload your file to a public server.
You can try even
<iframe src="http://localhost:8080/pdf">
I think there are plugins for iframe in wordpress ,Try it out..
In my Wordpress I use this plugin for Google Docs to embed .pdf
DirtySuds - Embed PDF
Then in the post use this:
[embed width="620" height="600"]http://site.com/file.pdf[/embed]
edit:
You will need live host to upload your .pdf files there.
I am trying make a php script to list the files of a folder above my web directory...I follow a small thing I found here which talked about
a symlink pointing to /var/uploads
a Apache Alias directive Alias /uploads /var/uploads
I did both of these.
$myDirectory = opendir("/var/stuff/stuff/");
That directory there links to like when I go in winscp and click that folder it directs me to it....and when I run my script to list all files inside /var/stuff/stuff/ it lists what is in /home/stuff/stuff.
The thing is when I click the links that it produces I get a not found on the server
The requested URL /stuff was not found on this server.
Would someone please be able to assist me with this?
Since the files are not under the root directory, you will not be able to download them directly, but What you can use for this issue is to create a downloader gateway.
I'll explain:
create a php script somewhere in your app, lets call it downloader.php
the downloader script would get a parameter, lets say: filename
now we could call the script like: http://YOUR-URL/downloder.php?filename=file-to-download
in your downloader.php file you can get the file name, read it from the file system, then force it to be downloaded by out puting its content and configure the correct headers
I'm not sure if you still need that but, if you need more assistance I can help you more with some code samples
ideally you can use .htaccess to hide your downloader gateway script
I'm having trouble with missing images on my server.
I have been developing a site locally using MAMP for a while and now that I have uploaded it to my server the images cannot be found. Firebug tells me "Failed to load the given URL".
The file structure is the exact same as it was locally and the code is also the same.
The php file trying to load the images is in the site's root folder along with the folder "images".
Here is the file structure: images/models/dreadfinsl1.jpg
Here is the page: http://eoghanoloughlin.net/george/index.php
Can anyone help me? It seems like it would be just one of those stupid problems / simple answers but I'm relatively new to this don't have much experience. It was working fine when I was using MAMP.
Looks like your in the /george/ map on the server, and i assume locally u used www/
try /george/images/models/dreadfinsl1.jpg
else you will have to use full path http://eoghanoloughlin.net/george/images/models/dreadfinsl1.jpg
Try to access an image which is in your server with the help of web browser by specifying absolute path of the image....
Like http://eoghanoloughlin.net/images/models/dreadfinsl1.jpg
If you found any image on the browser, try to display the same image on your index page...
I think specifying the file path is being a problem in your application....