Author Topic: Script access to uploaded file - Possible?  (Read 981 times)

0 Members and 1 Guest are viewing this topic.

Offline tvigar

Script access to uploaded file - Possible?
« on: 29. March 2010, 22:58:48 »
Hi There!  This is a great plugin!

The Goal:
We are currently using this excellent plugin to upload a gpx file, our hopes is that the WIS.ro map will be able to access this uploaded file and automatically write the gps overlay onto the map.

The Issue:
The .htaccess file blocks the ability to call the xml file and then use it to provide the gpx overlay.

Potential Solutions???:
Could the .htaccess file allow for a server side script to access the file, while protecting from other access to the file?  is it possible to allow an inclusion? 
Is there another technique that could facilitate this need?

Any thoughts or potential solutions would be greatly welcomed!!!

 :D
Country: Canada Canada |  OS: Windows Vista/Server 2008 Windows Vista/Server 2008 |  Browser: Firefox 3.6 Firefox 3.6 | View Profile

Offline mostafa

Re: Script access to uploaded file - Possible?
« Reply #1 on: 28. June 2010, 10:48:16 »
hi tvigar,

I have found the part of the plugin script that creats the .htaccess file
in the file components/com_sobi2/plugins/download/download.class.php

line 716
Code: [Select]
$htaccesPath =  _SOBI_CMSROOT.DS.$this->directory.$sobi2Id.DS.".htaccess";
  if(!file_exists($htaccesPath)) {
$htaccess = "<Files *>";
$htaccess .= "\n\t\t Order Deny,Allow";
$htaccess .= "\n\t\t Deny from all";
$htaccess .= "\n\t\t Allow from localhost";
$htaccess .= "\n </Files>";
if($htaccessFile = @fopen($htaccesPath,"w")) {
if(!@fwrite($htaccessFile, $htaccess)){
trigger_error("sobi_download::uploadFile(): Cannot put content in .htaccess file for protecting download directory");
}
@fclose($htaccessFile);
}
else {
trigger_error("sobi_download::uploadFile(): Cannot create .htaccess file for protecting download directory");
}
  }

you can change the code generated in the htaccess file with any code you find convenient
Code: [Select]
$htaccess .= "\n\t\t Order Deny,Allow";
$htaccess .= "\n\t\t Deny from all";
$htaccess .= "\n\t\t Allow from localhost";

or maybe you can delete the whole code
Code: [Select]
$htaccesPath =  _SOBI_CMSROOT.DS.$this->directory.$sobi2Id.DS.".htaccess";
  if(!file_exists($htaccesPath)) {
$htaccess = "<Files *>";
$htaccess .= "\n\t\t Order Deny,Allow";
$htaccess .= "\n\t\t Deny from all";
$htaccess .= "\n\t\t Allow from localhost";
$htaccess .= "\n </Files>";
if($htaccessFile = @fopen($htaccesPath,"w")) {
if(!@fwrite($htaccessFile, $htaccess)){
trigger_error("sobi_download::uploadFile(): Cannot put content in .htaccess file for protecting download directory");
}
@fclose($htaccessFile);
}
else {
trigger_error("sobi_download::uploadFile(): Cannot create .htaccess file for protecting download directory");
}
  }

and the htaccess file won't be created at all

regards,
Mostafa
Country: Egypt Egypt |  OS: Linux (Ubuntu) Linux (Ubuntu) |  Browser: Firefox 3.5.9 Firefox 3.5.9 | View Profile ketabtube كتاب تيوب

Do you want continued ongoing development, new features and active support?
Please write a review or just vote for SOBI on JED.

Tags: