Upload image overwrites existing record
I have a database table with a number of columns... name|age|gender|image|unique_ID... the problem is when I upload an image it overwrites some but not all of the images in the database...
I.E.
If the database record contains...
Joey|13|male|Joey.jpg|dfda3f5tt78
John|50|male|John.jpg|545963fd31a
Fred|50|male|Fred.jpg|5kma1alo45f
then I add...
Gary|50|male|gary.jpg|545963fd31a
the result will be something like this...
Joey|13|male|Gary.jpg|dfda3f5tt78
John|50|male|Gary.jpg|545963fd31a
Fred|50|male|Fred.jpg|5kma1alo45f
Gary|50|male|gary.jpg|545963fd31a
Thanks in advance for any help
I figured it out... I had unique_ID set as unique key so I changed it to "name" and it works fine
Similar Messages
-
I want to upload image in FB03.
When i enter doc no, fiscal year and company come in FB03, I am able to upload image but while recording the BDC in SHDB for FB03, I am not getting that upload(Attachment) button so that i can record the transaction and upload.
Can anybody suggest ?
Is there any other option to upload ?
Thanks
kumarhello ,
ref these postings
http://help-abap.blogspot.com/2009/02/generic-object-services-gos-toolbar.html(its Naimesh Patel blog.
Free GOS object
gos where is the file??
in your case BOR is BKPF.
regards
Prabhu
Edited by: Prabhu Peram on May 19, 2009 4:18 PM -
Hello,
I am facing a wired issue with Picture Libraries in SharePoint.
We created a custom field and added it to UserInfo list, the column based on custom field lets user upload their personal images to a Picture Library with the name <User ID>.<Image Extension> e.g. 1.jpg where UserID is internal Listitem ID of the UserInfo list and set its URL to the field value which we use to display the image on our custom user profile and some other WebParts.
If the user uploads a different image, it will overwrite the existing one it keeping the same name.
The field worked perfectly with sites using widows Based authentication, but as we move the field to sites with form based authentication we find that the field is able to upload the image properly first time but on each successive upload, although a new image gets uploaded with the name userid.imagextension and is shown in the allitems.aspx page in the thumbnail view and in the picture preview on the dispform.aspx page, but the link next to the name field and the image shown on clicking the preview points to the old image.
To put it other way
https://<Web URL>/Picture%20Library/_w/Upload_jpg.jpg
https://<Web Url>/Picture%20Library/_t/Upload_jpg.jpg
Would show the updated image
but the actual URL
https://<Web Url>/Picture%20Library/Upload.jpg
points to the old image
what’s even more strange is that even after deleting the image the url still shows the old image at
https://<Web Url>/Picture%20Library/Upload.jpg
I confirmed the same by actually repeating the same exercise on a picture Library in the User Interface
Uploading an image say upload.jpeg in the picture library using SharePoint interface.
Then uploading a different jpeg image keeping the same name upload.jpeg again in the picture library.
In allitems.aspx thumbnail view and on dispform.aspx page preview filed image now show the newly uploaded image but when you click the preview image or click the link in the name field value it takes you back to the old image.
I have seen this issue on environment where we have enabled form based authentication and the issue is not seen on another server where we have wss with windows based authentication.
Has anyone noticed such behavior and is there any workaround to that!
Thanks & Regards
Saurabh RustagiAll,
I had the same issue.
In my case, Blob Cache was enabled for the web application in which the image issue was occuring.
I cleared blob cache, and after doing a hard refresh of my browser, the correct image was then displayed.
To clear blob cache, do the following:
Navigate to:
http://yourwebapp:port/yoursite/_layouts/objectcachesettings.aspx
Select: "Object Cache Flush" and "Force all servers in the farm to flush their object cache" check boxes
Click the OK button
Hope this helps. -
"file does not exist on remote server" when uploading image
As the title says, when uploading an image im getting the
message "file does not exist on remote server"......yet dreamwever
has uploaded the file, its there. All other pages on my website
work fine when uploading images. Any ideas?What image type is it? Is it in an images folder or the root
directory? It would be helpful to post a link. -
Hi ,
I have uploaded image in AL11 and trying to link to thorough OA_UPLOAD_AND_LINK program. But when crosschecked it is existing there.
passed values in selection screen link below= >
while doing it an error is coming 'Either no file exists in the directory or the directory cannot be found'.
Directory is identified by program but file does not.
Any solution?
P.S. files are uploaded and saved in JPG formatTry to clear the flag "Processing in Front End", in this way the program will search for the file on application server and not from the front end.
Or select a file directly from your computer.
Regards. -
Overwriting an existing record.
Hi..
I want to know whether we can overwrite an existing record in a database table.
That is when a user accidently insert a data for a particular primary key which is already existing, the data entered latter should be overwirted?..
Please help me..You can use a syntax like this :
begin
insert into <table> values(<Empid>,<Name>,<No.of resource>);
exception
when dup_val_on_index then
update <table) set Name = <Name>, No_of_resource = <No.of resource>
where Empid = <Empid>;
end; -
Disable "Overwrite existing files" when upload doument
Dear team,
in document library, when upload document, i don't want the document to overwrite the documents with the same name.
there is chekbox in upload page, that is default checked, I searched and some people said that I can update the upload page, find the checkbox control, and set the value to false, so i update the value in Upload.aspx and Uploadex.aspx page to change the
value.
but after changing the value, I cannnot open the upload page successfully, it always shows error.
Did I do anything wrong?Hi Greetings.
This is not the right procedure
Scording to your post, my understanding is that you wanted to override SharePoint OOTB Upload.aspx default for " Overwrite existing files" checkbox.
We can use the AdditionalPageHead delegate control to change the default without modifying upload.aspx.
There is an article for your reference, although it is about the WSS3.0, it still works for SharePoint 2013: Turn Default Upload Overwrite Off in WSS 3.0
Please follow the steps as below:
Download the solution file form here
Copy the wps file to the Disk C.
Open the SharePoint 2013 Management Shell.
Run the command: add-spsolution c:\ DefaultUploadOverwriteOff.wsp
Open the Center Administration, click System Setting->Manage Farm Solution-> dp.sharepoint.workflow.wsp->Deploy to one or more Web Application.
Open the site, clilck Site settings-> Site collection features-> Default Upload Overwrite Off->Active.
Open the library, the 'overwrite existing files' checkbox will be unchecked.
Source Link http://social.technet.microsoft.com/Forums/office/en-US/0a94c70b-20e5-4cee-93e2-fbaf50a9ac07/removing-the-overwrite-existing-files-checkbox-which-appears-when-uploading-a-new-document-in?forum=sharepointgeneral
Please remember to click 'Mark as Answer' on the answer if it helps you -
How can I upload/display image within a record ?
Hi,
I like to integrate an image into a record. Say, we have a table with columns: name, address, telefon, image
How do I upload the image into that very "image" field and display it in a report ?
<br>TIA
<br>BernhardGreetings,
I have a question. Following the howto on the upload/download app, and then being able to successfully upload the image into the DB, is it possible to reference this image from with the Portal tablespace. IE, can I do an <img src="whatever here"> call and be able to pull that image into a portal page. Can I reference it outside HTMLDB?
-- Thanks in Advance
-- Cliff Moon
-- UTPA Webmaster -
Storing Uploaded Image Path into Mysql
Hi I am developing a cms and am using the code David gives in his book PHP Solutions, everything works fine but I can't work out how to extract the uploaded path so that it is stored in my table.
Help would be really appreciated, I am making good progress in learning the php especially with David's books but am still struggling when it comes to having to customized the code.
The code for the upload.php is as follows,
<?php
class Gp1_Upload{
protected $_uploaded = array();
protected $_destination;
protected $_max = 51200;
protected $_messages = array();
protected $_permitted = array('image/gif',
'image/jpeg',
'image/pjpeg',
'image/png');
protected $_renamed = false;
public function __construct($path) {
if (!is_dir($path) || !is_writable($path)) {
throw new Exception("$path must be a valid, writable directory.");
$this->_destination = $path;
$this->_uploaded = $_FILES;
public function getuploadpath (){
public function getMaxSize() {
return number_format($this->_max/1024, 1) . 'kB';
public function setMaxSize($num) {
if (!is_numeric($num)) {
throw new Exception("Maximum size must be a number.");
$this->_max = (int) $num;
public function move($overwrite = false) {
$field = current($this->_uploaded);
if (is_array($field['name'])) {
foreach ($field['name'] as $number => $filename) {
// process multiple upload
$this->_renamed = false;
$this->processFile($filename, $field['error'][$number], $field['size'][$number], $field['type'][$number], $field['tmp_name'][$number], $overwrite);
} else {
$this->processFile($field['name'], $field['error'], $field['size'], $field['type'], $field['tmp_name'], $overwrite);
public function getMessages() {
return $this->_messages;
protected function checkError($filename, $error) {
switch ($error) {
case 0:
return true;
case 1:
case 2:
$this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
return true;
case 3:
$this->_messages[] = "Error uploading $filename. Please try again.";
return false;
case 4:
$this->_messages[] = 'No file selected.';
return false;
default:
$this->_messages[] = "System error uploading $filename. Contact webmaster.";
return false;
protected function checkSize($filename, $size) {
if ($size == 0) {
return false;
} elseif ($size > $this->_max) {
$this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
return false;
} else {
return true;
protected function checkType($filename, $type) {
if (empty($type)) {
return false;
} elseif (!in_array($type, $this->_permitted)) {
$this->_messages[] = "$filename is not a permitted type of file.";
return false;
} else {
return true;
public function addPermittedTypes($types) {
$types = (array) $types;
$this->isValidMime($types);
$this->_permitted = array_merge($this->_permitted, $types);
protected function isValidMime($types) {
$alsoValid = array('image/tiff',
'application/pdf',
'text/plain',
'text/rtf');
$valid = array_merge($this->_permitted, $alsoValid);
foreach ($types as $type) {
if (!in_array($type, $valid)) {
throw new Exception("$type is not a permitted MIME type");
protected function checkName($name, $overwrite) {
$nospaces = str_replace(' ', '_', $name);
if ($nospaces != $name) {
$this->_renamed = true;
if (!$overwrite) {
$existing = scandir($this->_destination);
if (in_array($nospaces, $existing)) {
$dot = strrpos($nospaces, '.');
if ($dot) {
$base = substr($nospaces, 0, $dot);
$extension = substr($nospaces, $dot);
} else {
$base = $nospaces;
$extension = '';
$i = 1;
do {
$nospaces = $base . '_' . $i++ . $extension;
} while (in_array($nospaces, $existing));
$this->_renamed = true;
return $nospaces;
protected function processFile($filename, $error, $size, $type, $tmp_name, $overwrite) {
$OK = $this->checkError($filename, $error);
if ($OK) {
$sizeOK = $this->checkSize($filename, $size);
$typeOK = $this->checkType($filename, $type);
if ($sizeOK && $typeOK) {
$name = $this->checkName($filename, $overwrite);
$success = move_uploaded_file($tmp_name, $this->_destination . $name);
if ($success) {
$message = "$filename uploaded successfully";
if ($this->_renamed) {
$message .= " and renamed $name";
$this->_messages[] = $message;
} else {
$this->_messages[] = "Could not upload $filename";
?>
The code for my form page is this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
//THE FOLLOWING CODE IS FOR THE UPLOADING OF IMAGES AND FILES
// set the max upload size in bytes
$max = 51200;
if (isset ($_POST ['submit']))
//define the path to the upload folder
$destination = 'uploads/';
require_once('classes/Upload.php');
try {
$upload = new Gp1_Upload($destination);
$upload->setMaxSize($max);
$upload->move();
$result = $upload->getMessages();
} catch (Exception $e) {
echo $e->getMessage();
// END OF UPLOADING OF IMAGES AND FILES
?>
<form id="newvenue" action="" method="post" enctype="multipart/form-data" >
<?php
// THIS CODE DISPLAYS ERROR MESSAGES FOR THE FILE UPLOADS
if (isset($result)){
echo '<ul>';
foreach ($result as $message){
echo "<li>$message</li>";
echo '</ul>';
?>
<table id="neweventdisplay" cellpadding="5" border="0">
<tr>
<td></td>
<td><input type="hidden" name="user_id" value="" /></td>
</tr>
<tr>
<td></td>
<td>Organisers Name</td>
<td><input class="input80px" id="org_name" name="org_name" type="text" /> </td>
</tr>
<tr>
<td></td>
<td><label for="image">Upload image:</label></td>
<td><p>
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max; ?>" />
<input type="file" name="image" id="image" />
</p></td>
</tr>
<tr>
<td></td>
<td>Details about your upload</td>
<td><input class="input80px" id="org_uploadcapt" name="org_uploadcapt" type="text" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" id="submit" value="upload"></td>
</tr>
<tr>
<td class="heading"> </td>
<td></td>
</tr>
</table>
</form>
<prep>
<?php
if (isset ($_POST ['submit'])){
print_r($_FILES);}
?>
</prep>
</body>
</html>Hi David
Thank you very much for your help. I had continued to work on the code and had worked out how to input the image path into the database but it was using the original filename, so when every it is changed it did not work. The code in my page at that point was the following,
<?php // 2. NEW USER REGISTRATION<br />
include_once ("includes/form_functions.inc.php");
$max = 100000;
$destination = 'uploads/';
// START FORM PROCESSING FOR A NEW REGISTRATION
if (isset($_POST['submit'])) { // Form has been submitted.
$errors = array();
// perform validations on the form data
$required_fields = array('org_name');
$errors = array_merge($errors, check_required_fields($required_fields, $_POST));
$required_numberfields = array('user_id');
$errors = array_merge($errors, check_number_fields($required_numberfields, $_POST));
$fields_with_lengths = array('org_name' => 36, 'org_website' => 100, 'org_contact' => 40, 'org_conemail' => 80, 'org_contel' => 30);
$errors = array_merge($errors, check_max_field_lengths($fields_with_lengths, $_POST));
/*Here I am using trim as well as ucwords, this function converts the first letter of each work into a capital letter, I am using this only on the
firstname and surname to ensure that the data is how I want it as it is going into the database, The better the data is preformated the better the data
swill be within the database.*/
$org_name = trim(strtolower(mysql_prep($_POST['org_name'])));
$org_website = trim(strtolower(mysql_prep($_POST['org_website'])));
$org_contact = trim(strtolower (mysql_prep($_POST['org_contact'])));
$org_conemail = trim(strtolower (mysql_prep($_POST['org_conemail'])));
$org_contel = strtolower (mysql_prep($_POST['org_contel']));
$userid = $_POST['user_id'];
$org_uploadcapt = $_POST['org_uploadcapt'];
$image = $_FILES['image'];
/*Here is the code that takes the variable captured from the input form and matches it up with the appropriate field in the database. An important point with insertion is that the variables are in the same order as the mysql field names, there will be an error if the number of variables does not match the number of field names. Note that there is no entry for the user id as this is an auto increment file within mysql and so is not needed to be entered*/
if ( empty($errors) ) {
$sql = "INSERT INTO organiser
(org_name, org_website, org_contact, org_conemail, org_contel, user_id, org_uploadurl, org_uploadcapt)
VALUES
('{$org_name}', '{$org_website}', '{$org_contact}', '{$org_conemail}', '{$org_contel}', '{$userid}', '{$destination}".$image['name']."', '{$org_uploadcapt}' )";
$result = mysql_query($sql, $connection);
if ($result) {
$message = "The organiser was successfully created.<br />";
} else {
$message = "I am sorry but the organiser could not be added.";
$message .= "<br />" . mysql_error();
} else {
/* this counts the number of errors and informs the user of how many fields were
incorrectly entered*/
if (count($errors) == 1) {
$message = "There was 1 error in the form.";
} else {
$message = "There were " . count($errors) . " errors in the form.";
} else { // Form has not been submitted.
$org_name = "";
$org_website = "";
$org_contact = "";
$org_conemail = "";
$org_contel = "";
$userid = "";
$org_uploadcapt = "";
//THE FOLLOWING CODE IS FOR THE UPLOADING OF IMAGES AND FILES
// set the max upload size in bytes
if (isset ($_POST ['submit']))
//define the path to the upload folder
// Use This On The Local Hosting Machine
//$destination = 'C:/upload_test/';
// Use This On The Live Server
require_once('classes/Upload.php');
try {
$upload = new Gp1_Upload($destination);
$upload->setMaxSize($max);
$upload->move();
$result = $upload->getMessages();
} catch (Exception $e) {
echo $e->getMessage();
// END OF UPLOADING OF IMAGES AND FILES
?>
<title>Horse Events</title>
<?php include_once("includes/meta.inc.php");?>
<?php include_once("includes/cssfavgoogle.inc.php");?>
<link href="css/adminpanel.css" rel="stylesheet" type="text/css" />
<style>
input[type="number"] {
width:40px;
</style>
</head>
<body>
<div id="wrapper">
<div id="admincontent">
<form id="newvenue" action="neworganiser.php" method="post" enctype="multipart/form-data" >
<?php if (!empty ($message)) {echo "<p class=\"message\">" . $message . "</p>";} ?>
<?php if (!empty ($errors)) {display_errors($errors); } ?>
<?php
// THIS CODE DISPLAYS ERROR MESSAGES FOR THE FILE UPLOADS
if (isset($result)){
echo '<ul>';
foreach ($result as $message){
echo "<li>$message</li>";
echo '</ul>';
?>
<br />
<table id="neweventdisplay" cellpadding="5" border="0">
<tr>
<td></td>
<td><input type="hidden" name="user_id" value="<?php echo $url_userid ['user_id']; ?>" /></td>
</tr>
<tr>
<td> <span class="compuls">*</span></td>
<td>Organisers Name</td>
<td><input class="input80px" id="org_name" name="org_name" type="text" />
</td>
</tr>
<tr>
<td><span class="compuls">*</span></td>
<td>Their Website</td>
<td><input class="input80px" id="org_website" name="org_website" type="text" /></td>
</tr>
<tr>
<td><span class="compuls">*</span></td>
<td>Organisers Contact</td>
<td><input id="org_contact" name="org_contact" type="text" />eg: Mrs Jean Kelly</td>
</tr>
<tr>
<td><span class="compuls">*</span></td>
<td>Contact Email</td>
<td><input class="input80px" id="org_conemail" name="org_conemail" type="text" />
</td>
</tr>
<tr>
<td><span class="compuls">*</span></td>
<td>Contact Tel No.</td>
<td><input id="org_contel" name="org_contel" type="text" /></td>
</tr>
<tr>
<td></td>
<td><label for="image">Upload image:</label></td>
<td><p>
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max; ?>" />
<input type="file" name="image" id="image" />
</p></td>
</tr>
<tr>
<td></td>
<td>Details about your upload</td>
<td><input class="input80px" id="org_uploadcapt" name="org_uploadcapt" type="text" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" id="submit" value="Add Your Organiser"></td>
</tr>
<tr>
<td class="heading"> </td>
<td></td>
</tr>
</table>
<a class="delete" href="controlpanel.php">Cancel</a>
</form>
</div>
I have added the code you kindly forwarded but am getting an error, I am still trying to learn the basics of php and am unsure of what to do next, my php Upload.php now looks like
<?php
class Gp1_Upload{
protected $_uploaded = array();
protected $_destination;
protected $_max = 100000;
protected $_messages = array();
protected $_permitted = array('image/gif',
'image/jpeg',
'image/pjpeg',
'image/png');
protected $_renamed = false;
protected $_filenames = array();
public function __construct($path) {
if (!is_dir($path) || !is_writable($path)) {
throw new Exception("$path must be a valid, writable directory.");
$this->_destination = $path;
$this->_uploaded = $_FILES;
public function getMaxSize() {
return number_format($this->_max/100000, 1) . 'kB';
public function setMaxSize($num) {
if (!is_numeric($num)) {
throw new Exception("Maximum size must be a number.");
$this->_max = (int) $num;
public function move($overwrite = false) {
$field = current($this->_uploaded);
if (is_array($field['name'])) {
foreach ($field['name'] as $number => $filename) {
// process multiple upload
$this->_renamed = false;
$this->processFile($filename, $field['error'][$number], $field['size'][$number], $field['type'][$number], $field['tmp_name'][$number], $overwrite);
} else {
$this->processFile($field['name'], $field['error'], $field['size'], $field['type'], $field['tmp_name'], $overwrite);
public function getMessages() {
return $this->_messages;
protected function checkError($filename, $error) {
switch ($error) {
case 0:
return true;
case 1:
case 2:
$this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
return true;
case 3:
$this->_messages[] = "Error uploading $filename. Please try again.";
return false;
case 4:
$this->_messages[] = 'No file selected.';
return false;
default:
$this->_messages[] = "System error uploading $filename. Contact webmaster.";
return false;
protected function checkSize($filename, $size) {
if ($size == 0) {
return false;
} elseif ($size > $this->_max) {
$this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
return false;
} else {
return true;
protected function checkType($filename, $type) {
if (empty($type)) {
return false;
} elseif (!in_array($type, $this->_permitted)) {
$this->_messages[] = "$filename is not a permitted type of file.";
return false;
} else {
return true;
public function addPermittedTypes($types) {
$types = (array) $types;
$this->isValidMime($types);
$this->_permitted = array_merge($this->_permitted, $types);
protected function isValidMime($types) {
$alsoValid = array('image/tiff',
'application/pdf',
'text/plain',
'text/rtf');
$valid = array_merge($this->_permitted, $alsoValid);
foreach ($types as $type) {
if (!in_array($type, $valid)) {
throw new Exception("$type is not a permitted MIME type");
protected function checkName($name, $overwrite) {
$nospaces = str_replace(' ', '_', $name);
if ($nospaces != $name) {
$this->_renamed = true;
if (!$overwrite) {
$existing = scandir($this->_destination);
if (in_array($nospaces, $existing)) {
$dot = strrpos($nospaces, '.');
if ($dot) {
$base = substr($nospaces, 0, $dot);
$extension = substr($nospaces, $dot);
} else {
$base = $nospaces;
$extension = '';
$i = 1;
do {
$nospaces = $base . '_' . $i++ . $extension;
} while (in_array($nospaces, $existing));
$this->_renamed = true;
return $nospaces;
protected function processFile($filename, $error, $size, $type, $tmp_name, $overwrite) {
$OK = $this->checkError($filename, $error);
if ($OK) {
$sizeOK = $this->checkSize($filename, $size);
$typeOK = $this->checkType($filename, $type);
if ($sizeOK && $typeOK) {
$name = $this->checkName($filename, $overwrite);
$success = move_uploaded_file($tmp_name, $this->_destination . $name);
if ($success) {
$message = "$filename uploaded successfully";
if ($this->_renamed) {
$message .= " and renamed $name";
$this->_messages[] = $message;
} else {
$this->_messages[] = "Could not upload $filename";
public getFilenames() {
return $this->_filenames;
?>
The error is Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE.
I have not worked with oop before and have only very briefly looked at the principle was on my foundation degree. -
Hi
Can anyone give me instructions for deleting an uploaded image without deleting the whole record? For example, I have a record with an uploaded image, the image name stored in the table and the image in a directory. I change my mind and want no image associated with the record. How do I delete the image associated with the record and make that image name field null?
ThanksOK, I have it working in a round about way. I'm sure with Gunters help I could get it going the 'proper way" but for now this solution seems to be working.
on my detail list I added a link "remove current file" which only shows on the conditional region "show if file exists" so if there is no file this link will not show.. so far so good.
I think pass the URL parameter to a page which I'm filter by URL ID parameted called "deletefile.php"
I then added an update record form and only included the field that is storing the filename. In the wizard I inserted the field as a hidden field. I added a second hidden field and called it "null" and left the value for it blank.
In the update record behaviour you can choose to get the values from any form element in the form area. So I chose to get the values from the hiidden object "null".
when you submit form it will then put the field for the file back to "null'
I'm sure i can get the form to delete the file as well. I'll work on that next.
This does seem a little dirty but seems to be working perfectly fine.
Hope this helps anyone. -
How to upload and overwrite a file from a dynamic list
I need to come up with a way to upload and overwrite and existing image file from a dynamically generated list. For instance, there would be a drop-down select box with Company A, Company B, Company C, etc. and when the user selects one of them it should display a prompt to upload a new logo image file, overwriting the existing logo file. Any help would be appreciated.
I'm not sure why you need a prompt. Sounds like an unnecessary annoyance to me.
A simple form with a select and input type="file" should get you started. Then I would probably do something like:
1. upload the file to a temp folder on your server.
2. Rename it according to what company was selected.
3. Move it to it's permanent folder. -
Android - Upload Image in a Container
String connectionString = "DefaultEndpointsProtocol=https;AccountName=StorageAccountName;AccountKey=StorageAccountKey"
CloudStorageAccount storageAccount = CloudStorageAccount.parse(connectionString);
// Create the blob client
CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
// Get a reference to a container
// The container name must be lower case
CloudBlobContainer container = blobClient.getContainerReference("images");
// Create the container if it does not exist
container.createIfNotExists();
// Create a permissions object
BlobContainerPermissions containerPermissions = new BlobContainerPermissions();
// Include public access in the permissions object
containerPermissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER);
// Set the permissions on the container
container.uploadPermissions(containerPermissions);
// Create or overwrite the "myimage.jpg" blob with contents from a local file
CloudBlockBlob blob = container.getBlockBlobReference("myimageYdolo.jpg");
File source = new File(currImageURI.toString());
blob.upload(new FileInputStream(source), source.length());
I have used the above code to upload image in a storage container in azure from android. It throws the error on "// Create the blob client" line. some java.lang.verifyError. I have searched to solve this error but i can't find any solution.
Hi Veerasuthan,
For this issue, I suggest you could try the code below.
import com.microsoft.azure.storage.*;
import com.microsoft.azure.storage.blob.*;
public class BlobSample {
public static final String storageConnectionString =
"DefaultEndpointsProtocol=http;"
+ "AccountName=your_account_name;"
+ "AccountKey= your_account_key";
public static void main(String[] args) {
CloudStorageAccount account = CloudStorageAccount.parse(storageConnectionString);
CloudBlobClient serviceClient = account.createCloudBlobClient();
// Container name must be lower case.
CloudBlobContainer container = serviceClient.getContainerReference("myimages");
container.createIfNotExists();
Aslo, you could refer to this code sample (https://github.com/Azure/azure-storage-java). Please try it.
Any results, please let me know free.
Regards,
Will
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to write the new records not with existing records.
hi,
I have a script.If i execute the script it writes the records.but its writing with the exisiting records.It writes not only the new records but also the old records.
for eg: the exisiting records are:
1111115-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111116-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111117-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111118-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111119-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
but now what happend is the new records such as
1111116-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111117-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111118-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111119-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
it gets appended with the old existing records,
1111117-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111118-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111119-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111113-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111114-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111115-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111116-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111117-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111118-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111119-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
there will be some problem happens when we are going to upload a bulk data of say 25000 records.if its gonna update 20000 records,rest 5000 records i have to do it in next step,if this is going to happen then the first 20000 records will be displayed forever.because it have the capacity to write 20000 records.thenext 500 records will not be written.so there is a chance of redundancy.how to avoid this redundancy while running this script
my script is
create or replace procedure input_tables(table1 in varchar2)
is
str varchar2(32767);
cnt number(2);
cursor c1(tname in varchar2)
is
select column_name
from all_tab_columns
where table_name = tname
order by column_id;
rec c1%rowtype;
begin
cnt:= 1;
str:= 'declare '||
'cursor c2 '||
'is '||
'select ';
open c1(table1);
loop
fetch c1 into rec;
exit when c1%notfound;
if cnt = 1 then -- Added New
str:= str||rec.column_name; -- Added New
cnt:= cnt + 1; -- Added New
else -- Added New
str:= str||'||'',''||'||rec.column_name; -- Added New
end if; -- Added New
end loop;
close c1;
str:= str||' SRC from '||table1||';'||
' r2 c2%rowtype;'||
' ft UTL_FILE.file_type;'||
' str2 varchar2(200);'|| --Added New
' begin '||
' ft := UTL_FILE.fopen(''SAMPLE'',''OUTPUT.csv'',''w'');'||
' for r2 in c2'||
' loop '||
' UTL_FILE.put_line(ft,r2.SRC);'||
' end loop;'||
' UTL_FILE.fclose(ft);'||
' end;';
execute immediate(str);
end;
thanks,
Ratheesh.Hi!
U can check the following script --
create or replace procedure input_tables(table1 in varchar2,start_col in number,last_col in number)
is
str varchar2(32767);
cnt number(2);
cursor c1(tname in varchar2)
is
select column_name
from all_tab_columns
where table_name = tname
order by column_id;
rec c1%rowtype;
begin
cnt:= 1;
str:= 'declare '||
'cursor c2 '||
'is '||
'select ';
open c1(table1);
loop
fetch c1 into rec;
exit when c1%notfound;
if cnt = 1 then -- Added New
str:= str||rec.column_name; -- Added New
cnt:= cnt + 1; -- Added New
else -- Added New
str:= str||'||'',''||'||rec.column_name; -- Added New
end if; -- Added New
end loop;
close c1;
str:= str||' SRC from '||table1||
' where rownum between '||start_col||' and '||last_col||';'|| -- Added New
' r2 c2%rowtype;'||
' ft UTL_FILE.file_type;'||
' str2 varchar2(200);'|| --Added New
' begin '||
' ft := UTL_FILE.fopen(''SAMPLE'',''OUTPUT.csv'',''w'');'||
' for r2 in c2'||
' loop '||
' UTL_FILE.put_line(ft,r2.SRC);'||
' end loop;'||
' UTL_FILE.fclose(ft);'||
' end;';
execute immediate(str);
end;
/ To print first ten rows --
exec input_tables('EMP',1,10); --first 10 rowsTo print next remain rows --
exec input_tables('EMP',11,15);N.B: No tested....
Regrads.
Satyaki De. -
Creating new records while querying existing record
Hi,
I have one master - detail form.
First i created 1 record. Request ID is the primary key. Now request id generated. For ex.: 10
Request Id, date, requestor , location, status fields are in header block.
In lines block, i hv some other fields.. and one field called 'Activity'.
While creating first record, the activity will be 'New'.
Then i'll query the record '10'.
when i'm changing the activity 'New' into 'Upgrade', it should create new record with new request ID.
How to do this?
I hv written procedure that, i'm taking field values to local variables. Then assigning the local variable values to field values.
It is not creating as new record. It overwriting the existing record with new values. Existing record is missing.
Pl. give steps.
Thanks
KaviHi,
Okk, you will have to do two things. Create two trigger on block level on which you want to do your changes.
1. First trigger. (PRE-UPDATE)
In pre-update trigger u will have to write the complete insert statement into the same table with new req id. like
DECLARE
vReqNo DATA_TYPE;
BEGIN
SELECT MAX(REQ_ID)
INTO vReqNo
FROM your_table;
INSERT INTO your_table
(req_no, fields....)
VALUES
(vReqNo, :forms_values);
END;
2. Create 2nd trigger on block level (ON-UPDATE)
write in this trigger
NULL;
for viewing the inserted record. What u have to do is in ON-UPDATE after null; create one timer NO_REAPEAT.
and in timer u will have to set the block property to req_id = generated_req_id_from_pre_update_trigger and
execute_query;
hope it will work...
-Ammad -
How to upload images in Internet Service object ?
Hi,
I have to upload/change the existing image in Internet Service object (Z program). The path where my current images are as follows:-
SE80->Internet ServiceZ Program->Theme->MIME Object-->Images->( Here I have to uplaod the image)
Please tell me how to do that. The transport request has to be generated while uploading.
Saurabh Garghi Saurabh,
Try this thread.
But there the transaction used is SE 78
Upload .TIF images in SE78
would this be of some help for you?
Cheers.....
Maybe you are looking for
-
Help with LINK WARNINGS and ROLLOVERS in GoLive CS3
Hello, After I publish my site, I am unable to get the rollovers to work. Could this because I am getting Link Warning messages on all of the pages? I have been troubleshooting for a few hours and can not seem to find the problem. I could use a fresh
-
A private web screen shows up when I close down apps on my ipad, but I don't want to see that web page EVER. It is a private "incognito" Skype number that I don't want ANYONE to see.
-
General query regarding the implementation of a Flash Streaming Server
Hey lads, I'm looking at setting up an Adobe Flash Streaming Server at work. It will be used primarily to stream training videos across our Intranet - we have ~1000 users at the moment, with the capacity to expand to ~2000). We are looking at both fi
-
Report is going in warning r12
Hi expert, many times my users complain me all reports is going in warning. in this case i check the manager if the all manager are active and the manager's actual and target are different. i down all manager and after down all manager completely r
-
Scripting a layer style for each layer to make a depth pass from focus stacking information.
I'm trying to generate a depth pass from rack focus. Basically where I've gotten to right now is importing the rack focus footage each frame from as an individual layer. Then running Auto Blend Layers and letting photoshop do it's magic to mask out e