Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

image uploading

Explorer ,
Sep 26, 2008 Sep 26, 2008

Copy link to clipboard

Copied

hi guys,
i have a database with five image fields, and on my webpage i have file upload boxs so that users images can be uploaded to the images folder in my root folder, is there a way to automatically insert the path to the image into the image fields in the database, i would think that it would have to involve some hidden fields but i am reletivly new to dreamweaver and would apprieciate some advice, i am using a php page
Cheers
TOPICS
Server side applications

Views

316
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 26, 2008 Sep 26, 2008

Copy link to clipboard

Copied

In most cases you can just include the path when you call the image, like
this:
<img src="images/mapOfTheWeek/thumbnails/<?php echo
$row_getMap['mapWeek_imageNameThumb']; ?>" border="0" />

Jeff

"meesonator" <webforumsuser@macromedia.com> wrote in message
news:gbird6$dfo$1@forums.macromedia.com...
> hi guys,
> i have a database with five image fields, and on my webpage i have file
> upload
> boxs so that users images can be uploaded to the images folder in my root
> folder, is there a way to automatically insert the path to the image into
> the
> image fields in the database, i would think that it would have to involve
> some
> hidden fields but i am reletivly new to dreamweaver and would apprieciate
> some
> advice, i am using a php page
> Cheers
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 29, 2008 Sep 29, 2008

Copy link to clipboard

Copied

this may be a daft question but, where would you put the code?

<img src="images/mapOfTheWeek/thumbnails/<?php echo
$row_getMap['mapWeek_imageNameThumb']; ?>" border="0" />

Thanks

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 29, 2008 Sep 29, 2008

Copy link to clipboard

Copied

In fact, that's the way you normally would do it. It's not a good idea to
include paths in the data field, since if the path ever changed, you would
have to edit EVERY record.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"Jeff" <jeffs@NoSpamLamSam.com> wrote in message
news:gbirp4$dqr$1@forums.macromedia.com...
> In most cases you can just include the path when you call the image, like
> this:
> <img src="images/mapOfTheWeek/thumbnails/<?php echo
> $row_getMap['mapWeek_imageNameThumb']; ?>" border="0" />
>
> Jeff
>
> "meesonator" <webforumsuser@macromedia.com> wrote in message
> news:gbird6$dfo$1@forums.macromedia.com...
>> hi guys,
>> i have a database with five image fields, and on my webpage i have file
>> upload
>> boxs so that users images can be uploaded to the images folder in my root
>> folder, is there a way to automatically insert the path to the image into
>> the
>> image fields in the database, i would think that it would have to involve
>> some
>> hidden fields but i am reletivly new to dreamweaver and would apprieciate
>> some
>> advice, i am using a php page
>> Cheers
>>
>
>

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 29, 2008 Sep 29, 2008

Copy link to clipboard

Copied

Show us your code, please.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"meesonator" <webforumsuser@macromedia.com> wrote in message
news:gbqb8q$q8v$1@forums.macromedia.com...
> this may be a daft question but, where would you put the code?
>
> <img src="images/mapOfTheWeek/thumbnails/<?php echo
> $row_getMap['mapWeek_imageNameThumb']; ?>" border="0" />
>
> Thanks

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 29, 2008 Sep 29, 2008

Copy link to clipboard

Copied

LATEST
This is the file upload code

<?php
// ---------------------------------------------
// Pure PHP Upload version 1.1
// -------------------------------------------
if (phpversion() > "4.0.6") {
$HTTP_POST_FILES = &$_FILES;
}
define("MAX_SIZE",0);
define("DESTINATION_FOLDER", "./upload");
define("no_error", "/Student Logged In.php");
define("yes_error", "/student profile edit error.php");
$_accepted_extensions_ = "3dm,3dmf,ai,bmp,drw,dxf,eps,gif,indd,jpeg,jpg,mng,pct,pdf,png,ps,psd,psp,qxd,qxp,svg,tif,";
if(strlen($_accepted_extensions_) > 0){
$_accepted_extensions_ = @explode(",",$_accepted_extensions_);
} else {
$_accepted_extensions_ = array();
}
$_file_ = $HTTP_POST_FILES['pimage1'];
if(is_uploaded_file($_file_['tmp_name']) && $HTTP_POST_FILES['pimage1']['error'] == 0){
$errStr = "";
$_name_ = $_file_['name'];
$_type_ = $_file_['type'];
$_tmp_name_ = $_file_['tmp_name'];
$_size_ = $_file_['size'];
if($_size_ > MAX_SIZE && MAX_SIZE > 0){
$errStr = "File troppo pesante";
}
$_ext_ = explode(".", $_name_);
$_ext_ = strtolower($_ext_[count($_ext_)-1]);
if(!in_array($_ext_, $_accepted_extensions_) && count($_accepted_extensions_) > 0){
$errStr = "Estensione non valida";
}
if(!is_dir(DESTINATION_FOLDER) && is_writeable(DESTINATION_FOLDER)){
$errStr = "Cartella di destinazione non valida";
}
if(empty($errStr)){
if(@copy($_tmp_name_,DESTINATION_FOLDER . "/" . $_name_)){
header("Location: " . no_error);
} else {
header("Location: " . yes_error);
}
} else {
header("Location: " . yes_error);
}
}

// ---------------------------------------------
// Pure PHP Upload version 1.1
// -------------------------------------------

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines