New topic: 

Issue with modifying/changing a profile picture...

<http://forums.realsoftware.com/viewtopic.php?t=47604>

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        terreywe          Post subject: Issue with modifying/changing a 
profile picture...Posted: Mon Apr 15, 2013 11:57 am                         
Joined: Wed Oct 31, 2012 11:21 pm
Posts: 12                Hi all,

having some slight issues, with trying to modify a picture for an item. The 
idea is that lets say the product image/color has changes, therefore we need to 
change the "profile picture" of that product..

The issue, I have a coding that will replace the image/canvas, and also store 
the absolutepath for the DB to pickup....the main issue is that just noted, if 
the new image is saved in the same location and retains its old 
name/filepath...it will prompt that there is already an item with such a name, 
select YES to replace the file, but when checked, the old picture still is 
there.Also checked in the picture folder, it still retains the old picture, 
although i've pressed yes to replace it earlier...

Wondering if there is anything in my code, that seems to be causing this 
issue....any help would be greatly appreciated....

**********************************
  Dim dlg3 as New SaveAsDialog
  Dim f3,g3 as FolderItem
  
  g3 = GetopenFolderItem("") 
  if g3 = nil then
  Msgbox " No Item Selected"
  Else
  dlg3.Filter = FileTypes1.All //set for picture images.
  dlg3.SuggestedFileName= "("+prname.text+") Front View"
  f3=dlg3.ShowModal() 
  
  end if
  
  If f3 <> Nil then
  picpath1.Text = f3.AbsolutePath
  if picpath1.LimitText >255 then
  msgBox " PATH NAME IS TOO LONG. PLEASE CHOOSE PATH LESS THEN 256 CHARS"
  picpath1.Text = ""
  TabPanel6.Value = 2
  else
  g3.CopyFileTo(f3)
  msgbox "FILE SAVED" 'The file 'should' be saved

  end if
  
  Else
  msgbox "FILE NOT SAVED"
  //user canceled
  End if
  
  if picpath1.Text <> "" then
  pic1done.Visible = true
  else
  pic1done.Visible = false
  end if
  

**********************************

Again, appreciate any help in regards to this, again, the code works, if i 
change the name or target folder. But if it is the same with the old data, then 
it fails...im pulling out my hair trying to understand this...so any help would 
save my hair loss    
                             Top                Paul Lefebvre          Post 
subject: Re: Issue with modifying/changing a profile picture...Posted: Tue Apr 
16, 2013 4:03 pm                       Site Admin                
Joined: Fri Sep 30, 2005 9:35 am
Posts: 955
Location: South Portland, Maine                If I understand you, it sounds 
like you just need to check if the file already exists and delete it before you 
attempt to copy the file to the new location.

Try something like this:

If f3.Exists Then
  Try
  f3.Delete
  g3.CopyFileTo(f3)
  Catch e As IOException
  MsgBox("File I/O Error: " + e.Message)
  End If
End If
      
_________________
Paul Lefebvre
Developer Evangelist
Real Software, Inc.

The Real Studio Developer Conference is back: April 23rd-26th, 2013 in Orlando, 
FL.  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to