1

Topic: Uploading file

Hi I have set permissions to upload folder (chmod 777)
I try to upload a file with correct extension (.jpg)

and I get an error saying that i can not upload to the table a file that is owned by user

how do I fix this?

2

Re: Uploading file

Can you post the exact error message you get? Also, is it the browser application that displays the error message or is it LabStoRe?

3 (edited by jadv 2008-08-26 02:50:18)

Re: Uploading file

Oh I am sorry, I found the answer. The default upload directory in the config.php was incorrect for my setup. I now have a new question.

How do I get it to display the uploaded file in the search results webpage?

4 (edited by patnaik 2008-08-27 03:23:21)

Re: Uploading file

With some code modification, you can have the images viewed on the search results page.

The display of images is not a feature in the current version of LabStoRe. Different images can have different sizes and that can affect the layout of search result pages.

You can try the following code modification, though.

Each category of items has its own module file in LabStoRe. E.g., for cell-lines, there is modules/cell-line.php. You have to edit the code of the appropriate module file(s). Following is an example using modules/plasmid.php (for plasmids). Part of the code of the module file dictates the specific details that are to be shown in the results page. This code fragment specifies the table headings:

echo ('<colgroup><col width="40" valign="top" align="left" /><col valign="top" align="left" /><col valign="top" align="left" /><col valign="top" align="left" /><col valign="top" align="left" /><col valign="top" width="170" align="left" /></colgroup><tr style="background-color:'.$heading_color.';" valign="top"><td></td><td >Name/description</td><td>Vector/insert</td><td >Owner/creator</td><td>Download</td><td></td></tr>');

To have, e.g., plasmid-map images shown, modify it to add another column at the third-last position ('Plasmid map'):

echo ('<colgroup><col width="40" valign="top" align="left" /><col valign="top" align="left" /><col valign="top" align="left" /><col valign="top" align="left" /><col valign="top" align="left" /><col valign="top" width="170" align="left" /></colgroup><tr style="background-color:'.$heading_color.';" valign="top"><td></td><td >Name/description</td><td>Vector/insert</td><td>Plasmid map</td><td >Owner/creator</td><td>Download</td><td></td></tr>');

Then for each row, a new cell has to be added for the new column. The original code fragment that specifies the row cells looks like:

echo ('</td><td>'
.$row["vector"]);
if ($row["insert"] !='')
{
echo ('<br />'.$row["insert"]);
}
  //---------------------------------------------------
echo ('</td><td>'
.$row["owner"]);
  //---------------------------------------------------
echo ('</td><td>');
    // provide link to download files
if ($row["map_file"] != '')

It is modified to:

echo ('</td><td>'
.$row["vector"]);
if ($row["insert"] !='')
{
echo ('<br />'.$row["insert"]);
}
  //---------------------------------------------------
echo ('</td><td>');
  //---------------------------------------------------
    // show plasmid map
if ($row["map_file"] != '')
{
       // table data is of form - 'The filepath is - table-name/file-name'
       // for plasmids, so, filename is table data minus first 27 characters
       // 'The filepath is - '=[18]'plasmids'=[+8]'/'=[+1]
 $file = substr($row["map_file"], 27);
 if (file_exists('../interface_creator/uploads/plasmids/'.$file))
  {echo ('<img src="../interface_creator/uploads/plasmids/'.$file.'" alt="plasmid map" height="50px" width="50px" style="border: 1px black dotted;" />');
  }
} 
echo ('</td><td>'
.$row["owner"]);
  //---------------------------------------------------
echo ('</td><td>');
    // provide link to download files
if ($row["map_file"] != '')

The image height, width, style, etc. can be set as per your choice.

With a bit of PHP and HTML knowledge (a couple of hours to acquire), more can be done.

5

Re: Uploading file

that is awesome I will try it out! Thanks for the help.

Is it possible to associate more than one file with an entry?

say I have an antibodies DB and I want to be able to have an IF image and a WB image for each antibody, or is it limited to only one file per entry

6

Re: Uploading file

great! I added a line so that the thumbnail is a link and it pops up the full sized image in a new window :-)

7

Re: Uploading file

jadv wrote:

say I have an antibodies DB and I want to be able to have an IF image and a WB image for each antibody, or is it limited to only one file per entry

The default LabStoRe does not have an antibody-specific module. It uses the 'protein' module for storing antibody records. You can alter the 'protein' module and the 'protein' database table, or you can create an antibody-specific module and use the antibody database table. There is a bit of information on creating new modules in the readme file.

Either way, you first have to alter the antibody/protein table in the MySQL database to add new columns for storing information about the IF/WB image files. Say, you created two text-type fields 'if_image' and 'wb_image'.

Next, you browse to the admin section of the interface creator of LabStoRe at yoursite.com/path/to/stocks/interface_creator/admin.php to either 'install' the 'antibody' table or update the 'protein' table (which will bring in 'if_image' and 'wb_image' into the system).

Then you 'configure' the new input fields [columns] ('if_image' and 'wb_image' when modifying the 'protein' module, or the two and the remaining columns when creating the 'antibody' module). Configuring in this case will involve stating that the 'if_image' and 'wb_image' are for file-uploads.

Finally, you edit/create the modules->protein.php/antibody.php file to have the images show up.

This should be easy if you are familiar with PHP, and you can use existing module files as guides/templates.

Let me know if you need more help.